Posts

Showing posts from 2019

What is a fait accompli tactic?

A fait accompli (accomplished fact in French) is a negotiating tactic, generally used by diplomats, but also used in business. The principle is that one party will take a surprise action to create a favorable negotiating position. This accomplished fact impacts the outcome of the negotiation. The fait accompli tactic works because it creates action. Once something is done, it is hard to get it undone and therefore, the balance of power between the parties is altered. What does a fait accompli look like in a typical business negotiation? Here are a few examples: • Violate a patent, and then work on the settlement • Start a lawsuit, then talk • Have a machine installed, then reject it and ask for a credit • Declare bankruptcy before entering a settlement negotiation

handling html attributes with dashes with htmhelper in mvc for Invalid anonymous type member declarator

In versions prior to ASP.NET MVC 3, you could not declare HTML attributes with dashes/hyphens , without creating a custom type that handled dashes for you. Most of you, who have used custom data attributes with dashes in MVC 1 and 2, must be familiar with the Compiler Error CS0746: if you use attribute name e.g "data-name", you will see an error Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access However in ASP.NET MVC 3, there is a trick that can be used to handle HTML attributes with dashes. Just use ‘underscores’ in your custom data attribute instead of ‘hyphens’. MVC 3 using the HTML helpers, automatically converts these underscores into dashes/hyphens eg:  @Html.HiddenFor(Model => Model.PartnerId, new { ng_model = "PartnerId" }) when view will be rendered then it'll be convert as shown below. <input type="hidden" name="PartnerId" val...

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: