Posts

Get RowNumber with linq to sql in c#

Query: var itemlist = db.Items.Where(x =>  x.UserId == Id && DbFunctions.TruncateTime(x.LoanDueDate.Value) < DbFunctions.TruncateTime(DateTime.Now)).AsEnumerable().Select((r, i) => new { i=i+1, r }).ToList(); Try using this query, It'll help :)

'App not installed' Error on Xamarin Android

Image
If you encounter an error like 'App not installed' on Android Phone. It may happen when you uninstall the program and try to reinstall the .apk file. Here is what I tried to solve this problem

The request body must contain the following parameter: 'client_secret or client_assertion'

Image
What type is the AAD registered Application in your case? If the clientId is from a "Server-side Web app", then specify an extra option -clientsercet. Otherwise register a "Native app" and use the clientid alone.

missing compiler required member 'microsoft.csharp.runtimebinder.binder.convert'

Image
To be able to compile you need to add a reference to   Microsoft.CSharp.dll . Follow the steps below: 1. Right click on references 2. Click on add reference and a modal with the left menu (assemblies, projects, COM and browse) will appear. 3. Click Assemblies 4. Check Microsoft.CSharp and click Ok. 5. Clean and build your project and the error should disappear.  There you go!

Bring back restoring database in SqlServer

Image
If you see the database restoring as depicted in the figure below You can you the query below to solve the issue RESTORE DATABASE [Database Name]    WITH RECOVERY

Log into event viewer using c#

Image
T his code will write directly to the event log Application: //Reference using System.Diagnostics; //Program using (EventLog eventLog = new EventLog("Application")) {    eventLog.Source = "Application";    eventLog.WriteEntry("Your Message", EventLogEntryType.Information, 101, 1); } Figure below depicts the event viewer log:

Difference between Indexed and Stored in SOLR

Typically you will want your field to be either indexed or stored or both. If you set both to false, that field will not be available in your Solr docs (either for searching or for displaying). See Alexandre's answer for the special cases when you will want to set both to false. As stated   here   :   indexed=true   makes a field searchable (and sortable and facetable). For eg, if you have a field named   title with   indexed=true , then you can search it like   q=tite:test , where test is the value you are searching for. If   indexed=false   for field   title then that query will return no results, even if you have a document in Solr with   title 's value being test . stored=true   means you can retrieve the field when you search. If you want to explicitly retrieve the value of a field in your query, you will use the   fl   param in your query like   fl=title (Default is   fl=*   meaning ret...