Sunday, August 9, 2015

NuGet Package Manager All Problems & Solution

I have used NuGet Package Package Manager for some years now. And following are all the problems it presented to me in my projects & their solutions when used in Visual Studio


  1. Package manager console is your friend. It will solve a lot of problems that NuGet package manager UI will give up on. Having problems uninstalling a package that is also a dependency of another NuGet package & UI won't cut it for you, No problems just run below command on package manager console.
  2. uninstall-package newtonsoft.json -force
      • Another note about package version mismatches: If you are installing a package X that depends on package Y, Installing X will install Y too with the specific version of Y it needs for X. Then if you install package Z that also depends on Y, package Y's version will get overwritten with version that Z needs for it. Understanding this process can help resolve most version conflicts between NuGet packages.

  3. I used Nlog package and faced issues issues with Nlog NuGet package not installing the correct dependent dll packages like Commons.Logging or Commons.Logging.Nlog[Any version number]. Quick way to solve all dependency problems with NuGet package is to install the highest dependency which will automatically install the correct versions of all dependent NuGet packages. As explained here.
  4. Getting a version conflict or mismatch errors. No worries use below command to install the specific version you are looking for to resolve the conflict.
  5. install-package newtonsoft.json -version "5.0.6"

  6. if a package's dll is missing you will usually get errors like "cannot find dll vx.0...". Use below command to get the dll back into your project.
  7. Update-Package –reinstall Newtonsoft.Json.  

  8. If getting an error stating "nuget exited with code 1"
    1. Remove the .nuget folder from the solution in Visual Studio
    2. Delete the .nuget folder from disk (keep Visual Studio open)
    3. Right-click on the solution in the Visual Studio solution explorer and re-enable NuGet package restore
  9. if your application can't find a NuGet package's correct version make sure in app.config the following entry for the package has the correct version.
  10. <bindingredirect newversion="3.2.0.0" oldversion="0.0.0.0-3.2.0.0"> </bindingredirect></div>
    
    
  11. Last one, simple but annoying, Just published a NuGet package & can't find the correct version in the UI when installing it. Sometimes the UI will show two different entries for same NuGet package with different versions.

Sunday, November 22, 2009

My Prolog Notes

Just putting my prolog notes up, hope they might help somebody:

father(f,c);-parentof(f,c),male(f).


-only predicate matching is done in prolog


grandfather(g,c):-parentof(f,c),
parentof(g,f),male(g)

ancestor(a,c):- parentof(a,c),
ancestor(x,c),ancestor(a,x)

-in prolog we represent the relationship france has_capital paris == has_captial

(france,paris).

works_at(nadeem,punjab_university).
cost_of(pill,900).
bright(ahmed).
enjoys(haroon,riding).
likes(yasmin,ice_cream).
tall(ali).
hits(ali,timmy) ^ with(cricket_bat).
travels_by(waleed,plane) ^ to(mecca).
lives_at(farid,16 sawan road) ^ in(isb).


-in prolog there are facts which are represented as predicates. Now there are two

main ways to represent facts in prolog
-Clausal Form consequence < antcentdents
-Horn Clauses(When prepositions are used for resolutions) two types:
1) Atomic Preposition
2) Empty Left Side
-Prepositions can be stated in two modes:
-one in which truth of the statements is known (facts)
-second the truth is yet to be known (Queries)
-Rules are like stored queries that represent more complex relaionships between

predicates which are based on simple relationships. The head of the rule is only

true when the goals in the body of the rule succeeds.
Read it like this:
Head:- head is true if this is true

-You are eligible for scholarship if you score A grade or your father is a

pensioner.
scholarship(X) :- grade_A(X). scholarship(X) :- father_pen(X).


- and or is like this in prolog

We combine both disjunctions and conjunctions together.
Consider: A woman is happy if she is healthy, wealthy or wise
happy(Person):- healthy(Person),woman(Person).
happy(Person):-wealthy(Person),woman(Person).
happy(Person):-wise(Person),woman(Person).

Monday, October 5, 2009

First Step To Research

To start a research one needs to know that what is happening all-round in the current domain to gather some context. To know this read research papers of that.

The best source of research papers is ‘Google Scholar’ give it the reference to research paper and it will find that paper, But there only the abstract and summary of research paper will be present and never the whole paper. The research papers are normally placed in Digital Libraries of the Universities and if you are not part of the faculty you cannot access it unless you have a reference or you can have membership of organization such IEEE which will give you access to their research paper repositories. If you don’t have either then all you are left with is gathering information using abstract and summary.

Once you have the research paper what you need to do is to first skim it rather then read it. If you find it very relevant to your research topic then you should read it thoroughly while taking notes. After reading write your own summary for it and a small critique for it.

If there are two research paper on the same topic. You can sort them out using the following criteria:

• If it’s published in conference it’s a descent one (Conferences level one and two level only)
• If it’s published in journal then it’s a good one.

It is not about gathering others arguments and mixing it all together and presenting it as your own work this is sheer dishonesty and against the spirit of research. So whenever using an idea which is given by somebody else ALWAYS gives reference to the original idea.

Monday, August 3, 2009

Some Terms in Computer Programming

There are some terms in computer programming which are very closely related to each other so i am writing this post rather as a reference to have crystal clear concepts which may provide base to high level of Abstractions.

POINTERS:
A datatype which holds the address of another index of the memory. If not used correctly can result in Segmentation faults(pointing to bad memory location)(C & C++). Because of pointer arithematic and many other allowed uses the pointers are considered unsafe.

References:
A Reference in computer science has two different meanings depending on the context in which used:
1:A reference in computer programming is a value which allows a program to access a a particular memory address directly or any other resource.
2:In C++ context its a datatype which also points to another object in the memory but is less powerfull and more safer then pointer. Some level of restriction is posed on this datatype through which it becomes safer. It cannot be left uninitialized, it cannot be reseated, it cannot be null.

3:Handlers:
Handlers are kind of abstract pointers which are used to access a resource which is managed some other entity eg: a memory block managed by operating system or a TCP socket managed by OS its handler is a file discriptor

Friday, July 10, 2009

Gtest Starters Help(Building and Writing Tests)

Summary: This article will help you configure google test for the first time in Visual Studio IDE. It will take you through the installation process to writing your first ATP's on gtest.


!!!Installation:
• After Downloading Gtest the next step is to build it. To do this is fairly easy just open \msvc\gtest.sln’ in Visual Studio and Build it just like any other project.
• After Building notice that a ‘Release’ folder will be created in ‘\msvc’. That’s it you are ready to write you first ATP’s.


!!!Making a Test Project(Note: These are the settings only for release mode):
• Place the gtest directory in the local folder(where there is bin directory) of your project so that it can be machine independent
• Make a win32 console application Project in VS2008 with language settings as C++
• Go into Solution Explorer > Right Click Top Node > Add > Existing Project and Add two projects :
o \msvc\gtest
o ‘\msvc\gtest_main
• Go into Project Menu > Properties > Configuration Settings > C/C++ > Code Generation and set
o Basic Run Time Checks to “Both (/RTC1, equiv. to /RTCsu) “
o Run Time Library to “Multi-threaded(/MT)”

• Go into Project Menu > Properties > Configuration Settings > C/C++ > Optimization and set optimization: Disabled (/Od)

• In your Visual Studio Project open: Project Menu > Properties > Configuration Settings > C/C++ > Additional Dependencies(All configuration in combo box)
o Add on a new line in double quotes ‘$(InputDir)\gtest-1.3.0\include’ folder.
o Now make a Separate Source file and in that write the test methods using TEST’ macro
o And in Projects main source file call the tests using RUN_ALL_TEST

Note: is the gtest Directory which should be placed at the local project location
For Additional Help: http://code.google.com/p/googletest/w/list

Wednesday, June 17, 2009

My favourite Quotes


  1. Friendship is unnecessary, like philosophy, like art... It has no survival value; rather it is one of those things that give value to survival. C. S. Lewis
  2. Victory breeds hatred, for the conquered is unhappy. He who has given up both victory and defeat, he, the contented, is happy. ~Buddha
  3. Carlson’s Law. Curt says that when the world gets this flat and connected everything that happens from the top down tends to be dumb and slow. Everything that happens from the bottom up tends to be smart, but chaotic. The sweet spot for innovation, though, is moving down – that makes sense, because all of us are smarter than one of us and all of us now have so many more tools to create, connect, communicate and collaborate.
  4. “Thus, from the war of nature, from famine and death, the most exalted object which we are capable of conceiving, namely, the production of the higher animals, directly follows. There is grandeur in this view of life, with its several powers, having been originally breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and most wonderful have been, and are being, evolved.”  Charles Darwin, The Origin of Species