Category Archives: Technical

How to link reference libraries in git repository?

I have been looking into solution that how can I link my pre-compiled dlls into different projects in git repositories, and, I don’t want to copy dependencies code always in each repository. 

 

Drawing

This can be achieved by creating Git sub-module in repository where you want to use it.

Following steps need to be done:

 

Step 1: Go on top level directory where sub module needs to link:

 

$ cd <local path of git repo> 

cd c:/bitbucket/mylocalrepository 

Step 2: Create submodule in repository:

git submodule add path_to_repo path_where_you_want_it
$git submodule add http:/githubrepo/repository.git Repositories

This will create submodule in lib folder of my local repository.

When you want to update to a newer version of one of the libraries, cd into the submodule and send pull request:

cd Repositories
git pull

Troubleshooting: Windows 10 stuck at log in screen after upgrade

Last night, I upgraded my windows 7 to windows 10 on my desktop. Everything was going smooth, but after restarting machine, login screen was stuck when click on Next button (at right bottom). There was no error message pop-up and computer was restarting after 10-15 minutes. This was weird behavior and there was no clue, what was going behind the scene.

IMG-20160109-WA0001 [3564180]

After searching on google, I found a discussion forum, where somebody suggested click “Next” button from keyboard only, which didn’t work for me. Finally, another suggestion about disabling WiFi adapter and restart the machine worked for me.

I removed USB WiFi adaptor and after click on Next button, it continues.

If you end up with similar situation, then it is worthwhile to try this trick.

Screen after Next buttonWP_20160109_002 [3564192]

 

Forum link: my-windows-10-update-stuck-welcome-back-screen-how-can-i-fix

 

Task runners in Visual Studio 2015

There are various kinds of tasks typically used by web developers as part of their workflow. Everything from bundling and minifying JavaScript files, to compiling LESS files into CSS and even running custom batch or PowerShell scripts.

In a sense you can say that tasks are steps that needs to be performed to make the application run that are separate from coding it.

Visual Studio 2015 supports any kind of custom task execution from the new Task Runner Explorer tool window. It ships with built-in support for two very popular web centric task runners – Grunt and Gulp.

The Task Runner Explorer shows a list of available tasks and executing them is as simple as a click of the mouse. You can even bind any task to specific events that occur in Visual Studio such as Build, Clean and Project Open.

Sure you can use the command line to invoke your custom tasks, but with the integration into Visual Studio you can automate a lot more of your workflow.

There are quiet a few extensions freely available that adds support for a lot more task frameworks.

NPM Scripts Task Runner

npmThis task runner adds support for npm scripts listed in the scripts section of a package.json file. This allows you to run any executable with any arguments simply by modifying package.json.

You can read more about npm scripts and how to set it up in the npm documentation.

Download | Source code

 

Command Task Runner

commandIs similar to the NPM Script Task Runner in that it can execute any executable, but with the main difference that you don’t need a package.json file. Also, this extension supports inline PowerShell and batch commands.

This make it perfect for any type of project that has custom .cmd or .ps1 files as part of the build process.

Download | Source code

 

WebPack Task Runner

webpackFrom the webpack website: webpack is a bundler for modules. The main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.

Webpack is getting more and more popular and seems to be resonating very well with React.js developers.

Download | Source code

 

Broccoli Task Runner

broccoliFrom the Broccoli is a build tool that is very popular with developers using the ember.js JavaScript framework, but can be used in any web project.

From their website: A fast, reliable asset pipeline, supporting constant-time rebuilds and compact build definitions. Comparable to the Rails asset pipeline in scope, though it runs on Node and is backend-agnostic.

Download | Source code

 

Brunch Task Runner

brunchBrunch is a builder. Not a generic task runner, but a specialized tool focusing on the production of a small number of deployment-ready files from a large number of heterogeneous development files or trees.

Download | Source code

 

ASP.NET 5 Task Runner

aspnetAllows you to easily execute the scripts in project.json’s scripts section such as prepublish and postbuild. But you can also specify your own custom scripts that this extension can then execute.

This makes it possible to setup a full build process from a single location.

Download | Source code

 

All of these extensions demonstrate just how flexible the Task Runner Explorer in Visual Studio is. If you find your favorite task runner framework to be missing from this list, please let us know in the comments.

NoSql (It’s “Not only SQL” not “No to Sql”)

This is my first post on NoSql database technologies. There have been drastic changes in database technologies over the few years. Increase in user’s requests, high availability of applications, real time performance forced to think on different database technologies. We have traditional RDBMS, memory and NoSql databases available in market to suffice particular business needs. Here I’ll illustrate some of key aspects of NoSql databases like what is NoSql, why we need it, advantages and disadvantages of NoSql.

What is NoSql Movement?

It’s a different way of thinking in database technologies. It is unlike relational database management system where we have tables, procedures, functions, normalization concepts. NoSql databases are not built primarily on tables and don’t use sql for manipulation or querying database.

NoSql databases have specific purpose to achieve, that means NoSql database might not support all the features like in relational databases.

NoSql databases are based on CAP Theorem.

  • Consistency: Most of the applications or services attempt to provide strong consistent data. Interactions with applications/services are expected to behave in transactional manner ie. Operation should be atomic (succeed or failure entirely), uncommitted transactions should be isolated from each other and transaction once committed should be permanent.
  • Availability: Load on services /applications are increasing and eventually services should be highly available to users. Every request should be succeed.
  • Partition tolerant: Your services should provide some amount of fault tolerance in case of crash, failure or heavy load. It is important that in case of these circumstances your services should still perform as expected. Partition tolerant is one of desirable property of service. Services can serve request from multiple nodes

Why NoSql?

Since NoSql databases are using for specific purpose. They are normally using for huge data where performance matters. Relational database systems are hard to scale out in case of write operation. We can load balance database servers by replicating on multiple servers, in this case read operation can be load balance but write operation needs consistency across multiple servers. Writes can be scaled only by partitioning the data. This affects reads as distributed joins are usually slow and hard to implement. We can support increase in no. of users or requests by scaling up relational databases which means we need more hardware support, licensing, increase in costs etc.

Relational databases are not good option on heavy load which are doing read and write operations simultaneously like Facebook, Google, Amazon, Twitter etc.

A NoSQL implementation, on the other hand, can scale out, i.e. distribute the database load across more servers.

clip_image002

Source: Couchbase.com

Common characteristic in NoSql databases

· Aggregating (supported by column databases): Aggregation usage to calculate aggregated values like Count, Max, Avg, Min etc. Some of NoSql provides support for aggregation framework which have inbuilt aggregation of values. Approach in column databases is to store values in columns instead rows (de-normalized data). This kind of data mainly used in data analytics and business intelligence. Google’s BigTable and Apache’s Cassandra supports some feature of column databases.

· Relationships (support by graph databases): A graph database uses graph structures with nodes, edges and properties. Every element contains a direct pointer to adjacent element; in this case it doesn’t need to lookup indexes or scanning whole data. Graph databases are mostly use in relational or social data where elements are connected. Eg. Neo4j, BigData, OrientDB.

 

image

Source: wikipaedia

 

· Document based. Document databases are considered by many as the next logical step from simple key-/value-stores to slightly more complex and meaningful data structures as they at least allow encapsulating key-/value-pairs in documents. Eg. CouchDb, MongoDb.

Mapping of document based db vs relational db

 

Document Based Databases Relational databases
Collections Table
Document Row

 

· Key- Value Store: Values are stored as simply key-value pairs. Values only stored like blob object and doesn’t care about data content. Eg. Dynamo DB, LevelDB, RaptorDB.

· Databases Scale out: When the load increases on databases, database administrators were scaling up tradition databases by increasing hardware, buying bigger databases- instead of scale out i.e. distributing databases on multiple nodes /servers to balance load. Because of increase in transactions rates and availability requirements and availability of databases on cloud or virtual machine, scaling out is not economic pain in increasing cost anymore.

On the other hand, NoSql databases can scale out by distributing on multiple servers. NoSQL databases typically use clusters of cheap commodity servers to manage the exploding and transaction volumes.  The result is that the cost per gigabyte or transaction/second for NoSQL can be many times less than the cost for RDBMS, allowing you to store and process more data at a much lower price;

Now question here is why scaling out in RDBMS is hard to implement. Traditional databases support ACID properties that guarantee that database transactions are processed reliably. A transaction can have write operations for multiple records, so to keep consistency across multiple nodes is slow and complex process, because multiple servers would need to communicate back and forth to keep data integrity and synchronize transactions while preventing deadlock. On the other hand NoSql databases supports single record transaction and data is partitioned on multiple nodes to process transactions fast.

· Auto Sharding (Elasticity): NoSql databases support automatic data sharding (horizontal partitioning of data), where database breaks down into smaller chunks (called shard) and can be shared across distributed servers or cluster. This feature provides faster responses to transactions and data requests.

 

· Data Replication: Most of NoSql supports data-replication like relational databases to support same data-availability across distributed servers.

 

· No schema required (Flexible data model): Data can be inserted in a NoSQL DB without first defining a rigid database schema. The format of the data being inserted can be changed at any time, without application disruption. This provides greater application flexibility, which ultimately delivers significant business flexibility.

 

· Caching: Most of NoSql databases supports integrated caching to support low latency and high throughput. This behavior is contrast with traditional database management systems where it needs separate configuration or development to support.

Challenges of No-SQL

Till now we have seen significant advantages of NoSql over RDBMS, however there are many challenges to implement NoSql.

Maturity: Most of the NoSql databases are in open source or in pre-production stage. In this case it might be risk to adopt these databases on enterprise level. For small business or use case it might be better to consider. On the other hand RDBMS databases are matured, providing many features and having good documentations or resources.

Support: Most of RDBMS are not open source that means they come with commitment and assurance in case of failure. They are reliable products and properly tested. Most of NoSql databases are open source and not widely adopted by organizations. It is very hard to get effective support from open sources databases. Some of NoSql databases created by small startups for specific needs, not for global reach.

Tools: RDBMS databases have lot of tools to monitor databases, queries analyzing, optimizations, performance profiling, analytics and Business Intelligence. Objective of NoSql databases are to minimize use of admin tools which has not achieved fully yet, still there are certain things which need skills and tools to monitor database activities.

When to consider NoSql

Following are some of indicators you can consider while choosing NoSql database for your application:

· If your application needs high performance databases.

· Need less or zero administration of databases.

· You want flexible data model. Minor of major changes should not impact whole system.

· Application that needs less complex transactions.

· High availability.

· Not or less consideration on Business Intelligence and analytics.

References:

· http://nosql-database.org/

· http://www.couchbase.com

· www.mongodb.org

· http://en.wikipedia.org/wiki/Nosql

Enhanced by Zemanta

General tips: How to run Visual Studio as administrator always

Some times it is needed to run visual studio as administrator for system level activities like if you want to setup IIS virtual directory in your visual studio project, To setup IIS settings etc.

If you want to run visual studio as administrator once, you can right click devenv.exe and select “Run As Administrator”.

But sometimes there are requirement to run visual studio always as admin then you can set privilege level to administrator. Here are the steps:

Step 1 : Goto to executable of Visual studio IDE in “C:Program Files(x86)Microsoft Visual Studio 9.0Common7IDE”, Right click on devenv.exe -> Properties -> Compatibility-> And Select “Run as Administrator” check box.

You will also need to setup for visual studio launcher.

Step 2: Go to executable of Visual Studio Launcher on “C:Program Files (x86)Common Filesmicrosoft sharedMSEnvVsLauncher.exe” and follow same steps like step 1.

Colorize negative number using jquery in html table

Recently I was working on creating reports for clients on web portal. We are developing web portabl in asp.net MVC3 and using jquery utility functions.

One of the UI requirement was to colorize negative numbers. I can implement in server side in chtml pages but it would not be generic for all pages. So I decided to use jquery functions to do this task.

This is my html page:

<table class=”list”>
<tr>
<td>Date</td>
<td class=”right”>Amount</td>
</tr>
<tr>
<td>2012-05-01</td>
<td class=”right”>-5.156</td>
</tr>
<tr>
<td>2012-05-01</td>
<td class=”right”>-8.25</td>
</tr>

<tr>
<td>2012-05-01</td>
<td class=”right”>55.45</td>
</tr>
</table>​

Date Amount
2012-05-01 -5.156
2012-05-01 -8.25
2012-05-01 55.45

Java Script
On Dom Ready

$(function(){

$(“td.right”).filter(function() {
return $.trim($(this).text()).indexOf(“-“) == 0;
}).addClass(“negative”)​;
});

Css
.right
{
text-align:right;
}
.left
{
text-align:left;
}
.negative
{
color:red;
text-align:right;
}

.list
{
border: 1px solid;
}
.row
{
border: 1px solid;
}

Jquery filter function applied on td element which has class name “right”. this function find index of ‘-‘ and if it on first place it will return true. In case of true, css class “negative” will be applied to td tag.

we can also use contains functions to applied color.

$("td.right"):contains('-').addClass("negative");

Problem with this approach is it will apply negative class to any value which contains ‘-‘ on any place.

You can see live example at JFiddle.

http://jsfiddle.net/neerajkaushik_123/AwCqz/3/

Default Application Domains in CLR

 
When CLR loads first to execute managed code, it creates 3 application domains.  System and Shared domains are singleton for each CLR.

 

Application Domains

 

System Domain

    • It creates and Shared and default application Domains.
    • It Loads Mscorlib.dll (class library for system namespace) into shared domain.
    • Creation of default Exception instances (OutOfMemoryException, StackOverFlowException and FatalExecutionException): the reason to create these exceptions in advance is that in case of above exceptions to be raise system needs to creates instance and memory, but say if it is outofmemory exception then there will be no space to instantiate exception instance.
    • It keeps track all the domains in the process and manage them by loading or unloading AppDomains.

    Shared Domain

     

    • It contains mscorlib.dll
    • It contains basic system types like class, array, struct etc.

    Default Domain

     

  • It contains user code and resources for only this app domain.
  • Name of default domain is name of executable.

 

 

Reference: http://msdn.microsoft.com/en-us/magazine/cc163791.aspx#S1

Programming languages and contribution of Mathematics : An overview

Application of Discrete Mathematics in Computer Science

Discrete Mathematics play a vital role in software Development in Computer science . Almost ever program is based on some Mathematical Model . To explore the application of Discrete mathematics in computer science let us begin from the evolution of computer languages and how mathematics played important role in the evolution of computer languages .

Programming languages and contribution of Mathematics : An overview

Here, we will not explore the history of programming languages in detail but we will only focus on those parts which are concerned and connected to our topic. Computers are electronic devices which are made of registers ,logics & gates etc. All the electronic devices can only understand the ON and OFF logic. Mathematics fertilized logic with the mathematical logic operations and number system. Despite the complex hardware the computer systems operates on a very rudimentary level .10 symbol number system(0,1,2,…9) is too complicated for the computer system to process. At the logic level a computer can understand only two states i.e. ON logic and OFF logic. The ON state is represented by Binary 1 and OFF state is represented by Binary 0.In modern computers the most basic unit of information is a BIT (0 or 1).A processor reads some sequence of Bits and then Performs some binary operation on them. The information which is processed by processor generates some output. There are lot of abstractions involved the whole process.(abstractions like conversion of user input to binary information, than processing the information in the processor and then again converting the processor’s binary output to human readable format).

All the programming languages which are developed till now are Greatly influenced by Mathematics. we can say that the evolution of computer and programming is made possible only due to Mathematics and Mathematical Logic involved in it . Mathematical logic is a subfield of mathematics with close connections to the foundations of mathematics and theoretical computer Science .each and every assignment statements, subroutines, conditional statements, iteration, etc everything follows some mathematical Logic which is rooted from low level binary logic to high level computational logic.

The history of  Binary number system also known as BASE-2-NUMBER is very interesting and worth reading. evidence proves that binary numbers were used in India prior to around 5th–2nd centuries, more than 1500 years before their discovery in the west. The source of this discovery is a text of music by Pingala named “Chhandahshastra” meaning science of meters. Pingala developed mathematical concepts for describing prosody(poem), and in doing so he presented the first known description of a binary number system. The modern Binary numbers were discovered in the west by German mathematician Gottfried Leibniz in 1695 (Suggested Reading Leibniz G., Explication de l’Arithmétique Binaire, Die Mathematische Schriften, ed. C. Gerhardt, Berlin 1879, vol.7, p.223;). Let’s not Deviate focus from our topic .

In 1940’s with the invention of first electronic computer ,the first recognizable programming languages came into existence which is basically a low level assemble language. The Limited speed and limited memory capacity forced Programmers to write hand tuned assemble language programs. These assembly languages includes are very complex instructions. Even the programming of simple task is difficult and complex in assemble languages. These languages generally have binary information which needs to be converted into hex decimal codes to make it more Human Readable.

Between 1943-1945 Konrad Zuse proposed a programming language Plankalkül which is described for engineering purposes. It was the first high-level non-von Neumann programming language to be designed for a computer, Plankalkül was not published at that time due to the circumstances(2nd world war). In 1948 Zuse published a paper about the Plankalkül in the “Archiv der Mathematik” but still did not attract much feedback (Paper : for a long time to come programming a computer would only be thought of as programming with machine code). Plankalkül has drawn comparisons to APL(name after the book : A Programming Language) and relational algebra. It includes assignment statements, subroutines, conditional statements, iteration, floating point arithmetic, arrays, hierarchical record structures, assertions, exception handling, and other advanced features such as goal-directed execution. Plankalkül used Logical notation which was proposed in Begriffsschrift ( “concept-script”) a book on logic by Gottlob Frege, published in 1879. The Begriffsschrift was arguably the most important publication in logic since Aristotle founded the subject. The work of Plankalkül was influenced by Heinz Rutishauser. Heinz Rutishauser (30 January 1918 in Weinfelden, Switzerland – 10 November 1970 in Zürich) was a Swiss mathematician and a pioneer of modern numerical mathematics and computer science.

Between 1950 to 1957 lot of different programming languages like ARITH-MATIC, MATH-MATIC, MATRIX_MATH, FLOW-MATIC, etc are proposed .( Check the programming language timeline at http://en.wikipedia.org/wiki/Timeline_of_programming_languages)

In 1957 Fortran-I was introduced which is developed by IBM at their campus in south San Jose, California for scientific and engineering applications. In 1954-1955 FORTRAN concept was introduced. The Name FORTRAN is derived from The IBM Mathematical Formula Translating System. It is one of the most popular languages in the area of high-performance computing  and is the language used for programs that benchmark and rank the world’s fastest supercomputers. A significant improvement in programming languages and new programming languages which came overtime put more abstractions on internal design of programming and the mathematics involved in it.

Later in  1957 Noam Chomsky published a book Syntactic Structures  in which he developed the idea that each sentence in a language has two levels of representation — a deep structure and a surface structure. In 1959 Noam Chomsky introduced the mathematical Structure of a Grammar. This mathematical structure seeded all the modern programming languages.

In the summary written by ROBERT W. FLOYD in his paper The Syntax of Programming Languages-A Survey says

The syntactic rules for many programming languages have been expressed by formal grammars, generally variants of phrase-structure grammars. The syntactic analysis essential to translation of programming languages can be done entirely mechanically for such languages. Major problems remain in rendering analyzers efficient in use of space and time and in finding fully satisfactory formal grammars for present and future programming languages. “

References and Suggested Readings :

  1. http://home.ica.net/~roymanju/Binary.htm
  2. http://www.leibniz-translations.com/binary.htm
  3. http://en.wikipedia.org/wiki/Begriffsschrift
  4. http://en.wikipedia.org/wiki/Plankalk%C3%BCl
  5. http://www.zib.de/zuse/Inhalt/Programme/Plankalkuel/Plankalkuel-Report/Plankalkuel-Report.htm
  6. http://en.wikipedia.org/wiki/Heinz_Rutishauser
  7. http://www.jsoftware.com/papers/APL.htm
  8. http://www.win.tue.nl/~mvdbrand/courses/seminar/0809/papers/Floyd.pdf
  9. http://en.wikipedia.org/wiki/Fortran
  10. http://en.wikipedia.org/wiki/Timeline_of_programming_languages
  11. http://www.tutorialsdownload.com/application-of-discrete-mathematics-in-computer-science/

Setup connection on SSL with FIX server

 

Some broker support SSL to send message to FIX server. QuickFix engine does not have support for SSL. Some commercial QuickFix engine support it eg. OnixS ultra low latency .NET FIX Engine.

 

Here I am give example how we can connect to FIX server on SSL.

We can install third party network proxy software which can route calls on SSL. We can  Stunnel program to support it. It can be used to add SSL functionality to commonly used in daemons like POP2, POP3, and IMAP servers without any changes in the programs’ code.

QuickFIX Configuration in Stunnel

Add following entry to Stunel.conf config file to connect with FIX Server

;it can be any name

[FIXSERVER]
client = yes
accept = 127.0.0.1:3500
connect=<FIXSERVER Address>: <PORT>

 

image

 

You can change listening port to any free port on local machine.

 

Change in QuickFix config File

[default]
PersistMessages=Y
ConnectionType=initiator
UseDataDictionary=Y

[SESSION]
ConnectionType=initiator
FileStorePath=store
FileLogPath=fixlog
BeginString=FIXT.1.1
DefaultApplVerID=FIX.5.0

TransportDataDictionary=FIXT.1.1.xml

AppDataDictionary=FIX50.xml
SenderCompID=ABC
TargetCompID=FIXSERVER
SocketConnectHost=127.0.0.1
SocketConnectPort=3500
HeartBtInt=20
ReconnectInterval=30
ResetOnLogon=Y
ResetOnLogout=Y
ResetOnDisconnect=Y

 

image

 

I hope, it will help you.