Wednesday, October 22, 2014

How to check out visual studio solution file with out check out whole set of files.

Hi All

I had to save the solution file which is edited by notepad (Out side of the .NET IDE) . Problem was when I was checking out solution by it checked out the whole set of files in that solution including images, javascript files and CSS files as well.

Well, answer was very simple. Here are the steps.


  1. Do the changes to the solution file from outside editor (use notepad, notepad++) .
  2. Save the changes.
  3. Right mouse click on solution and add a new solution folder.
  4. Then Delete the solution folder which you added on step 3.
  5. Your solution file will check out with your changes.

Thanks!

Tuesday, September 2, 2014

Angular JS and Style tag in Internet Explorer.

I had this problem with AngularJs and Internet explorer. So here is the problem.



Internet explorer validating all html tags and it recognize this as a invalid style tags. So the fix is here.

HTML



JAVA SCRIPT - App.js


    $scope.GetStyle = function (t) {
        return "background-color: "+ t +";";
    };
    


Happy Coding Fellows!

Sunday, August 17, 2014

Windows Update freezes when you install updates in Windows 8, Windows 7, or Windows Vista

Since last few days my windows 7 did not shutdown and it was waiting to install windows update for ages. I gave that computer almost 12 hours to complete but it didn't work.  For this moment I don't know how I fixed that but I have done following things to fix that. One of those tries will give exact result you want with you windows.


  • Turn of your computer using power button . ( Kill it :D )
  • Start computer in normal mode.
  • Go to windows update.
  • Try to install updated or check for updates again. This will give you  an error message saying that it is installing some other updates. 
  • If that's the case restart your computer again with power button. once windows displays above error message it will stop installing that crappy update.
  • Then go to windows update and click check for updates.
  • If that work install windows updates and get a backup of your system or create a restore point. 
  • That will make sure if something go wrong on next time you'll be safe.

Again I'm really sorry I couldn't get any photos this time and cant exactly say what fix this problem. So follow above steps and let me know your result.


Thanks!

Tuesday, August 5, 2014

Basic Indexing and Searching Example with Apache Lucene.net

Lucene - Previous

1. Add Lucene.net to your application.
  • Copy Lucene.Net project to your solution folder or copy Lucene.Net.dll to your projects 
  • Add reference to Lucene.Net from the project your wish to use lucene as indexing 
  • Build your project.
2. Open writable Lucene database.

 Lucene database is a local file system folder which is the location of encrypted indexfiles generating from lucene.

  • FSDirectory is the class that we are using to create Lucene data folder in file system. This action will create write.lock file in target database path which is the lock file for that database. If you want to release this lock dispose the directory object and delete the write.lock file if its still exists. 

                          FSDirectory objDirectory  =  FSDirectory.GetDirectory(pstrDatabase_path);

  • Create Analyzer object to analyze and remove unnecessary chracters from indexing text. (@, a, :, / etc. )

                          Analyzer Analyzer = new StandardAnalyzer();

  • Create IndexWriter class to index text, html, numbers.

                          IndexWriter Writer = new IndexWriter(objDirectory, Analyzer);

3. Create your first index function with Lucene.


  • From section 2 we have


                FSDirectory objDirectory = FSDirectory.GetDirectory(pstrDatabase_path);
                Analyzer Analyzer = new StandardAnalyzer();
                IndexWriter Writer = new IndexWriter(objDirectory, Analyzer);


  • Create blank Lucene Document. Lucene will store your data as documents. Following code will create blank lucene document in memory. 
                Document doc = new Document();

  • Now we need to add data to this document. Data will be added as fields. Field is a keyvalue pair which include string key and string function. In later sections we may use fields which have custom data types. Following code line will insert string valued field to your lucene documents.


                doc.Add(new Field("FIELD_NAME", "FIELD_VALUE" , Field.Store.YES, 
                                                                                  Field.Index.NOT_ANALYZED));
  • Now we can add this document in to the Lucene writer from following code.
               Writer.AddDocument(doc);
  • Full code of indexing process.
              FSDirectory objDirectory = FSDirectory.GetDirectory(pstrDatabase_path);
              Analyzer Analyzer = new StandardAnalyzer();
              IndexWriter Writer = new IndexWriter(objDirectory, Analyzer);
              Document doc = new Document();
              doc.Add(new Field("FIELD_NAME", "FIELD_VALUE" , Field.Store.YES, 
              Field.Index.NOT_ANALYZED));
              Writer.AddDocument(doc);
              Writer.Commit();
              Writer.Close();

4. Searching an Index.


  • Creating Searcher object. Following code will create searcher object and it will take database path as a parameter.
            Searcher objSearcher = new IndexSearcher("C:\\Lucene_Data");

  • Create QueryParser object.
           QueryParser parser = new QueryParser("Default_Field", new StandardAnalyzer());

  • Create query from QueryParser object.
           Query query_lucene = parser.Parse("FIELD_NAME:FIELD_VALUE" );

  • Searching Lucene database and accessing data of searched documents.

           Hits hits = objSearcher.Search(query_lucene, sort);
           int aprox = (uint)hits.Length();
           for (int i = 0; i < aprox ; i++)
          {
          Document doc = hits.Doc(i);
                  string result = doc.Get("FIELD_NAME ");  
          }
          objSearcher.Close();


  • Complete simple search code.


            Searcher objSearcher = new IndexSearcher("C:\\Lucene_Data");
            QueryParser parser = new QueryParser("Default_Field", new StandardAnalyzer());
            Hits hits = objSearcher.Search(query_lucene, sort);
            int aprox = (uint)hits.Length();

            for (int i = 0; i < aprox ; i++)
           {
        Document doc = hits.Doc(i);
        string result = doc.Get("FIELD_NAME ");
           }

          objSearcher.Close();



If you need any help in other languages PHP, VB.net please comment.


Lucene - Previous





Monday, August 4, 2014

Apache Lucene.net - Introduction


Lucene - Next

What is Lucene.Net? 

Lucene.Net is a high performance Information Retrieval (IR) library, also known as a search engine library. Lucene.Net contains powerful APIs for creating full text indexes and implementing advanced and precise search technologies into your programs. Some people may confuse Lucene.net with a ready to use application like a web search/crawler, or a file search application, but Lucene.Net is not such an application, it's a framework library. Lucene.Net provides a framework for implementing these difficult technologies yourself. Lucene.Net makes no discriminations on what you can index and search, which gives you a lot more power compared to other full text indexing/searching implications; you can index anything that can be represented as text. There are also ways to get Lucene.Net to index HTML, Office documents, PDF files, and much more. Lucene.Net is an API per API port of the original Lucene project, which is written in Java even the unit tests were ported to guarantee the quality. Also, Lucene.Net index is fully compatible with the Lucene index, and both libraries can be used on the same index together with no problems. A number of products have used Lucene and Lucene.Net to build their searches; some well known websites include Wikipedia, CNET, Monster.com, Mayo Clinic, FedEx, and many more. But, it’s not just web sites that have used Lucene; there is also a product that has used Lucene.Net, called Lookout, which is a search tool for Microsoft Outlook that just brought Outlook’s integrated search to look painfully slow and inaccurate. Lucene.Net is currently undergoing incubation at the Apache Software Foundation. Its source code is held in a subversion repository and can be found here. If you need help downloading the source, you can use the free TortoiseSVN, or RapidSVN. The Lucene.Net project always welcomes new contributors. And, remember, there are many ways to contribute to an open source project other than writing code.

Downloading Lucene.Net 

You can find latest versions of Lucene.Net as complied binaries or source files from following URL. http://incubator.apache.org/lucene.net/download.html

Lucene - Next

Sunday, August 3, 2014

Force Image Width and Height Without Stretching

So here is the story. I just wanted to create an  image tag which has the same size of source image size. My problem was whenever the image source size larger than image tag html element image is fitting to borders.
I found the solution after few hours of googling and changing very few CSS lines.

All you have to do is add a style to your img tag like this.

style = "width: auto;height: auto;"

I'll upload the jsfiddle ASAP.

Happy coding fellows....

Linux Distributions For Beginners

1. Linux Mint 17


Linux Mint is the second most popular linux distribution simply because of its user friendliness It comes with loads of software carefully picked by the team, media codecs and drivers. The distro works so well out of the box you will not be spending any time trouble shooting. Mint focuses on what is best for its users and provides what the mainstream linux users demand (most of the time). Linux Mint 15 comes in 2 editions. The Cinnamon edition includes a modern Gnome 3 desktop with a familiar and traditional layout. The MATE edition comes with a Gnome 2 desktop. Compared to the cinnamon edition, the MATE edition is more stable but is outdated and quite boring. After years of development, Cinnamon has become one of the best DEs that are available for linux user who prefer a traditional desktop based on Gnome 3. Cinnamon has plenty of cool little features that are definitely worth checking out and you simply cannot go wrong with mint.
Linux mint is based on Canonical's Ubuntu.

2. Ubuntu 14.04


Ubuntu is the #1 and the most popular distro out there. Even though Linux Mint appeals more to users who prefer a traditional desktop experience, Ubuntu has a rigorous release cycle and tends to have more bleeding edge features implemented in each release. Ubuntu does not come with a load of software and codecs pre installed like Linux Mint. So new users may have trouble playing certain media formats and may require a few command line installations. But due to the excellent community support they can be sorted out within minutes.
Ubuntu comes with its own user interface called "unity". The unity desktop interface has come a long way and comes with tons of unique features that cannot be found on other desktops. But it may be not for everyone as it has a few quirks that some some users may find annoying. Good news is that it is configurable and certain features that you dislike can be disabled. Ubuntu 14.04 adds even more user friendly features to unity and is simply the best distribution for the average linux user.

3. Zorin OS 8


Zorin OS is optimized for users who are transitioning From windows. It looks quite similar to Windows 7 and comes with "zorin look changer" that can make your desktop look similar to older Windows versions and Mac OS X. Zorin OS also offers four premium versions (Ultimate, Business, Multimedia, Gaming) which are available upon donating. There is also a free version that does not come with as much software preinstalled. If you prefer a distro that works and functions similar to windows 7, Zoris OS provides the best out-of-the box experience. (even though other distros can be configured with a bit of effort)

4. Pinguy OS 14.04 LTS


Pinguy OS is an Ubuntu based distribution that comes with A LOT of software preinstalled. It is great for users who want to explore the extensive software that Linux has to offer. It is also very convenient because it includes almost all the software that a user may require. Pinguy OS is a fairly new distro but it is gaining popularity quickly. Pinguy OS includes two Docks by default and the overall look of the desktop leans toward OS X. Pinguy OS 14.04 includes a customized gnome-shell. Pinguy download images are quite huge since it packs a lot of software in it and the OS itself is a bit resource hungry(understandably). If you have a modern computer pinguy should run smoothly but if you have an older and limited PC, you may want to look at a lighter-weight distro.


5. Peppermint OS 4


Peppermint OS a very light distro that comes with LXDE desktop envioronment. LXDE is very simple to use and many will find it to be a straightforward DE. The OS boots up quite fast which makes it ideal for older computers or netbooks. Peppermint OS 4 is based on Lubuntu 13.04. It includes an elegant theme by default and includes media-codecs out of the box. If you require a feature-rich and light-weight distro, peppermint is the way to go.

Wednesday, July 30, 2014

Speed up your windows 7 computer

The most common problem with windows 7 users is getting operating system very slow by time. This can be happens due to several reasons.


  1. Computer Viruses - In this case  you should by antivirus program or download free antivirus program to clean your operating system. I don't recommend download pirate copies and hacking. If you have any idea about using a cracked antivirus software please don't! . Its always better for you to use free edition of any commercial antivirus software than using  a cracked antivirus software.
  2. Insufficient storage on your operating system drive.
  3. Lack of memory.

The best reason is windows indexing your files locations for fast file search. If you don't use thi search option often best thing to do is disable windows search indexing service. Here is how i did that.

Step 1 - Go to control panel
.


Step 2 - Go to programs and features.




Step 3 - Click on windows features on or off. Find windows search and uncheck.



Step 4 - Restart your computer.





Easy life fellows!


New JavaScript frameworks vs JQuery

JQuery

According to my knowledge jQuery is the best and stable javascript framework so far. If you are a student or a begginer who learning web development
I recomend you to learn core java script first and then move to jquery.

Installation and Helloworld

Advantage of jquery is most of jquery functions has very simple structure. So you dont need deep knowladge on core javascript. You'll become a professional
javascript developer in by time and you'll learn core javascript very quickly. Installation of jquery is very easy you can find everything you need from
w3schools  .I'm not going to teach you how to do this because you can find number of resources on web these days.


Cons of jquery so far

1. will add extra time to load your page.
2. You will depend on lot of third party plugins.
3. You will need to write more code lines than othe frameworks like angularjs.

Pros of jquery

1. Main thing is FREE. (jQUery, jQueryUI and jquery mobile)
2. Your code is more cleaner than angularjs code.
3. AJAX support.
4. jQUery works with most of old browser versions including internet explorer 7.
5. jquery has the top documentation and online community tutorials.

So my final recommendation for new coders is try to do your work with core java script first. If you need more functionality try jquery.

Happy coding fellows!







Tuesday, July 29, 2014

Easy Javascript class format - Works in all browsers

This is the most easiest java script pattern I found . Its works so nicely with many frameworks (jQuery, ExtJS) . 


Usage

 $(document).ready(function(){
   var mySamplePlugin = new SamplePlugin({ id : a }); //Input your parameters  
   mySamplePlugin.testFunction();                               
 }); 



  Model


var SamplePlugin = function (config) { 
    var p = this; 
    p.id = config.id; 

    p.testFunction = function () { 
      alert(p.id); 
    }; 

 }; 





 Happy Coding Fellows!

Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away.

Hi All I couldn't debug my C# class library project due to this issue for last few month. So this is the fix. 1. Right mouse click on the project which you have the issue with debugging. And go to properties. And click on build menu item.
2. Click on advanced option button.
3. Set debug info to full.



 Happy coding fellows!