I have an issue when building for iOS in Xamarin Studio:

I open Xamarin Studio and create a Single Project View App for IOS, I then run the project, but the project does not load onto the simulator all I get is the message

"Waiting for the debugger to connect to the iOS Simulator".

I have xcode installed on the machine.

Does anyone know how to solve this issue?

I've problem about using Genymotion Android emulator for xamarin development.

I have intalled Genymotion desktop app and several Android devices within it. Whenever i run any of the installed device in Genymotion desktop app via start button, it works fine but there is no Genymotion emulator in the list of available emulators in Visual Studio, neither in Xamarin studio (There are only built-in Android Emulators and devices installed in Xamarin Android player).

I found some articles about using Genymotion Emulator for Xamarin and all of them says that :

Both Xamarin Studio and Visual Studio with Xamarin discover it, no problem
I am using Visual Studio Enterprise Edition, Xamarin business editiorn and free edition of Genymotion, if that matters.

I try to search, read and write value from Bluetooth with Xamarin.forms But didn't find the one that can work. Suggestion some code or links for me please.

I have a class A like this:

public class Article
{
public Tag Test1 { get; set; } = new Tag();

}

public class Tag
{
public List<News> Test{ get; set; } = new List<News>();
}

I have a list like this:

News 1
   Tag 1{
             News 1
                   **Tag** {
                           News 1
                                Tag {....}
                           News 4
                                Tag {....}
                           News 5
                                Tag {....}
                       }
             News 4
                   Tag {....}
             News 5
                   Tag {....}
         }
News 2
News 3

I want to set null "Tag" 2nd on that list = null to avoid loop infinitely. like this:

News 1
   Tag 1{
             News 1
                   Tag = null
             News 4
                   Tag = null
             News 5
                   Tag = null
          }
News 2
News 3

I´m need to parse a json object into a c# class, my problem is that json object has a nested array and it´s throwing some errors when parsing.

I have tried a couple of options: a) do foreach in the elements of nested array, and add them to a new array b) parsing using json.deserialize

No success so far

These are my c# classes

public class itemPrediccion
{
    public string ClavePartido { get; set; }
    public string Ganador { get; set; }
    public bool EsFavorito { get; set; }
}

public class Prediccion
{
    public ObjectId _id { get; set; }
    public string IdUsuario { get; set; }
    public int Jornada { get; set; }
    public IEnumerable<itemPrediccion> PrediccionesJornada { get; set; }
}

An object of class "Prediccion" would contain a list of "itemPrediccion"

This is the json object that I want to parse to a "Prediccion" object

   {
"IdUsuario" : "user1", 
"Jornada" : "1",
"PrediccionesJornada" : [
    {
        "ClavePartido" : "AP2019J1P1",
        "Ganador": "Morelia",
        "EsFavorito": "false"
    },
    {
        "ClavePartido" : "AP2019J1P2",
        "Ganador": "Chivas",
        "EsFavorito": "false"
    },
    {
        "ClavePartido" : "AP2019J1P3",
        "Ganador": "Atlas",
        "EsFavorito": "true"
    }
]
}

This is how I´m trying to deserialize

string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);

Prediccion prediccionUsuario = new Prediccion {
                    IdUsuario = data.IdUsuario,
                    Jornada = data.Jornada,
                    PrediccionesJornada = data.PrediccionesJornada
                };

Throws this error:

Cannot implicitly convert type 'Newtonsoft.Json.Linq.JArray' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists (are you missing a cast?)

I am optionally display some content in the Unity Editor based on options chosen for a given component, this will be used when displaying a summary of options chosen on this current Component.

How I can make a function inline that returns a string, I want this function to be inline because there will be many of these and they will only useful in the line they are used in.

I have provided a code snippet that may clarify what I am trying to do.

I have used lambda functions like this in c++ and JavaScript, but not in c# and I've tried finding an answer on how to use them like this in C#.

var script = target as ButtonManager;//get reference to this Component 

EditorGUILayout.LabelField("Your current Interactive configuration", 
            "Parent: " + script.sceneParent.name + "\n",
            "Popup? " + ()=>{ if (script.isPopup) { return "Popup" } else { return "Change Scene"} }
            + "\n"
            );

When creating a new WebAPI Project in Visual Studio 2019 and changing authentication to Individual User Accounts, the only option is to connect to Azure but back in WebAPI projects in the .NET Framework, user accounts can be stored in-app. How to achieve this in .NET Core 2.2?

I have a C# project that creates a COM object for use with a POS terminal. Before I give it to the customer, I want to make sure that it will work as a COM dll. The RegAsm says it works.

using System;
using System.Runtime.InteropServices;

namespace POS
{
    [Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1a" )]
    [InterfaceType( ComInterfaceType.InterfaceIsDual )]
    [ComVisible( true )]
    public interface ITwoWay
    {
        // The Initialize method is called to establish the communications connection...
        [DispId( 1 )]
        void Initialize( String IPAddress, long Port, long MaxPacketSize );

        // A convenience method that allows the POS to test the Third Party’s back-end...
        [DispId( 2 )]
        void TestConnect();

        // The Terminate method is called to indicate that the POS system is about to terminate...
        [DispId( 3 )]
        void Terminate();

        // All interface calls made during a transaction send the same record format with specific reply fields ...
        [DispId( 4 )]
        void TransactionCall( String viPOSMsg, ref String InterceptArray );
    }
}

The actual entry points are defined in class TwoWay

using System.Runtime.InteropServices;
using System.EnterpriseServices;

namespace POS
{
    [Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1b" )]
    [ComDefaultInterface(typeof(ITwoWay))]
    [ClassInterface( ClassInterfaceType.None )]
    [ComVisible( true )]
    public class TwoWay : ITwoWay
    ...
    [ComVisible( true )]
    public void Initialize( string iPAddress, long port, long maxPacketSize )
    ...

I have a C# project that creates a COM object for use with a POS terminal. Before I give it to the customer, I want to make sure that it will work as a COM dll. The RegAsm says it works.

using System;
using System.Runtime.InteropServices;

namespace POS
{
    [Guid( ...

I have simple .NET Core 2.2 Web App that I have deployed to Azure App Service. App contains a simple HomeController with Index Action and Index.cshtml file.

When I try to browse the page it gives me InvalidOperationException with message The view '~/src/Views/Home/Index.cshtml' was not found.

I have verified the path of the file and build action (Content), but due to some strange reason it cannot find the view. However surprisingly if I change the name of the View to Index1.cshtml it works.

Can anyone explain why this is happening?

public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View("~/src/Views/Home/Index.cshtml");
        }
    }
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {

        app.UseDeveloperExceptionPage();
        app.UseStatusCodePages();
        app.UseStaticFiles();
        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });

    }

I expect it to render the Index.cshtml instead it give me this: InvalidOperationException: The view '~/src/Views/Home/Index.cshtml' was not found. The following locations were searched: ~/src/Views/Home/Index.cshtml

I am trying to create copy to Clipboard Component. Here is my code:

import React from 'react';
import logo from './logo.svg';
import './App.css';

class CopyClipboard extends React.Component {

  constructor(props) {
    super(props);

    this.state = { copySuccess: 'Copy to Clipboard!' }
  }

  copyToClipboard = (e) => {

    this.textContent.select();
    document.execCommand('copy');
    e.target.focus();
    this.setState({ copySuccess: 'Copied to Clipboard!' });
  };

  render() {
    return (
      <div class="positioning">
        {
           //if i need
        }

          <p onClick={this.copyToClipboard} ref={(c) => (this.textContent = c)}>yotam@gmail.com</p> <div class="success">{this.state.copySuccess}</div> </div>
    );
  }

}

export default CopyClipboard;

I get Parsing error: Unexpected token error. But if i use input tag then its work fine. Where i have done wrong?

Here's the task - I have an input field where I can enter a text and I would like to replace the occurrence of Vowels with numbers eg (A,E,I,O,U - 1,2,3,4,5) and add 'a' to all the other consonants eg - The input field takes in 'Victor as an input and what is printed on the page is 'Va3cata4ra'.

So far, i've been able to get the consonants to display an 'a' at the end of it using template literals and passing the variable to a setState. However I'm having issues getting the Vowels to show their numerical values as explained above. I've tried Switch , if else, for some reason, none is working

export default class App extends Component {

state = {
mytext: ''
}

onChangeHandler = (event) => {
    const newText = event.target.value;
    const splitText = newText.split('');
    let tempArr = []

    for (let onye in splitText) {
        else if (onye === 'e') {
            onye.replace(parseInt('2'))
        } else if (onye === 'i') {
            onye.replace(parseInt('3'))
        } else if (onye === 'o') {
            onye.replace(parseInt('4'))
        } else if (onye === 'u') {
            onye.replace(parseInt('5'))
        } else {
            return onye
        }

        //This got the consonants to display a after each one

        const raCon = `${splitText[onye]}a`
        tempArr.push(raCon)
    }

    this.setState({
        mytext: tempArr
    })

Expected result would have 'a' at the end of each consonant and numerical values for every vowel corresponding with (A,E,I,O,U)- (1,2,3,4,5)

Socket error shown.

   public Communicator(IPAddress toconnectto)
        {
            this.toconnectto = new IPEndPoint(toconnectto, port);
            local = new IPEndPoint(Tools.GetIp(), port);
            all = new IPEndPoint(IPAddress.Any, port); 
            udpClient = new UdpClient(AddressFamily.InterNetwork);
            udpClient.Client.Bind(new IPEndPoint(Tools.GetIp(), port));
            udpClient.AllowNatTraversal(true);
            udpClient.EnableBroadcast = true;
        }

        public void SendData(string data)
        {
            try
            {
                byte[] bdata = ASCIIEncoding.ASCII.GetBytes(data);
                udpClient.Send(bdata,bdata.Length,toconnectto);
            }
            catch(Exception ex)
            {
                ;
            }
        }
           public Communicator(IPAddress toconnectto)
    {
        this.toconnectto = new IPEndPoint(toconnectto, port);
        local = new IPEndPoint(Tools.GetIp(), port);
        all = new IPEndPoint(IPAddress.Any, port); 
        udpClient = new UdpClient(AddressFamily.InterNetwork);
        udpClient.Client.Bind(new IPEndPoint(Tools.GetIp(), port));
        udpClient.AllowNatTraversal(true);
        udpClient.EnableBroadcast = true;
    }

    public void SendData(string data)
    {
        try
        {
            byte[] bdata = ASCIIEncoding.ASCII.GetBytes(data);
            udpClient.Send(bdata,bdata.Length,toconnectto);
        }
        catch(Exception ex)
        {
            ;
        }
    }   public Communicator(IPAddress toconnectto)
    {
        this.toconnectto = new IPEndPoint(toconnectto, port);
        local = new IPEndPoint(Tools.GetIp(), port);
        all = new IPEndPoint(IPAddress.Any, port); 
        udpClient = new UdpClient(AddressFamily.InterNetwork);
        udpClient.Client.Bind(new IPEndPoint(Tools.GetIp(), port));
        udpClient.AllowNatTraversal(true);
        udpClient.EnableBroadcast = true;
    }

    public void SendData(string data)
    {
        try
        {
            byte[] bdata = ASCIIEncoding.ASCII.GetBytes(data);
            udpClient.Send(bdata,bdata.Length,toconnectto);
        }
        catch(Exception ex)
        {
            ;
        }
    }   public Communicator(IPAddress toconnectto)
    {
        this.toconnectto = new IPEndPoint(toconnectto, port);
        local = new IPEndPoint(Tools.GetIp(), port);
        all = new IPEndPoint(IPAddress.Any, port); 
        udpClient = new UdpClient(AddressFamily.InterNetwork);
        udpClient.Client.Bind(new IPEndPoint(Tools.GetIp(), port));
        udpClient.AllowNatTraversal(true);
        udpClient.EnableBroadcast = true;
    }

    public void SendData(string data)
    {
        try
        {
            byte[] bdata = ASCIIEncoding.ASCII.GetBytes(data);
            udpClient.Send(bdata,bdata.Length,toconnectto);
        }
        catch(Exception ex)
        {
            ;
        }
    }

Hi I have XML something like this :

<component AttributeA="1"> <Node1 AttributeB="AAAA" Name="John" /> </component>

in powershell I can load and read through xml like this :

[xml] $xmlDocument = Get-Content (#path to xml file)

Write-Host $xmlDocument.componet.AttributeA

Write-HOst $xmlDocument.componet.Node1.AttributeB

Write-HOst $xmlDocument.componet.Node1.Name

that gives me the fallow output :

1
AAAA
John

My question is there is a way to do the same in C++?, what about Java or C#

Thanks

Hi I have XML something like this :

<component AttributeA="1"> <Node1 AttributeB="AAAA" Name="John" /> </component>

in powershell I can load and read through xml like this :

[xml] $xmlDocument = Get-Content (#path to xml file)

Write-Host $xmlDocument.componet.AttributeA

Write-HOst $xmlDocument.componet.Node1.AttributeB

Write-HOst $xmlDocument.componet.Node1.Name

that gives me the fallow output :

1
AAAA
John

My question is there is a way to do the same in C++?, what about Java or C#

Thanks

I need to check the validity of the URL to different files without opening the link document/image. I used the below code in ASP.net 4.7.2 in validation attribute. The current code is as follows : (working fine with jpg)

public override bool IsValid(object DocumentURL)
    {
        try
        {
            string urlLink = (string)DocumentURL;
            WebRequest request = WebRequest.Create(urlLink);
            request.GetResponse();
            return true;
        }
        catch 
        {
            return false;
        }
    }

This works for images but failed when I sent a link to xls file. The error message is :

       "The request entity's media type 'text/plain' is not supported for this resource"
No mediaTypeFormatter is available to read an object of type 'W_Document_URL' media type 'text/plain'."

This looks like my function is trying to open the document. I need only to check the existence of the URL document but does not need to open it. Also if I need to restrict the documents to images(jpeg,png,bmp) and pdf, what is the best way to limit that inside this function?

I'm trying to map two entities to the same table with the same columns. The differences are HasQueryFilter condition for every entity and a column that takes part in the reference. The entities describe ralationship between dictionary and entity. When I launch it, I receive the following message: "... both mapped to column '' in '' but are configured with different nullability."

public class KeyValuesEntity : BaseEntity
{
    [Column("keyalphanr")]
    [StringLength(255)]
    public string keyalphanumber { get; set; }

    [Column("keydesc")]
    [StringLength(255)]
    public string keydescription { get; set; }

    [Column("keyvalint")]
    public int? keyvalueint { get; set; }
}

[Table("keyval")]
public class KeyValuesBaseEntity : BaseEntity
{
    [Column("keyalphanr")]
    [StringLength(255)]
    public string keyalphanumber { get; set; }

    [Column("keydesc")]
    [StringLength(255)]
    public string keydescription { get; set; }

    [Column("keyvalint")]
    public int? keyvalueint { get; set; }

    protected KeyValuesBaseEntity()
    {

    }
}

public sealed class OptionsEntity : KeyValuesBaseEntity
{

}

var lboptionsBuilder = modelBuilder.Entity<LBOptionsEntity>();

lboptionsBuilder.HasOne(lboptions => lboptions.optionholderKeyValue)
            .WithOne()
            .HasForeignKey<LBOptionsEntity>(lboptions => lboptions.optionholder)
            .HasPrincipalKey<OptionsEntity>(keyval => keyval.keyalphanumber);

I created a worked sql query:

select CONVERT(date, C.tDate) as dt, count(O.Id) as cnt from [Calendar] C
left outer join [Order] O
on C.tDate = CONVERT(date, O.Dt)
group by CONVERT(date, C.tDate)
order by CONVERT(date, C.tDate)

And I want to rewrite it use LINQ:

var res = (from c in db.Calendars
join o in db.Orders on c.tDate equals DbFunctions.TruncateTime(o.Dt.Value) into pp
from pl in pp.DefaultIfEmpty()
group c by DbFunctions.TruncateTime(pl.Dt.Value) into g
orderby g.FirstOrDefault().tDate
select new { date = g.FirstOrDefault().tDate, cnt = g.Count() }).ToList();

I get all rows from calendar in sql query, but only not null rows (right part) in LINQ query. How can I get all calendar's rows in LINQ.

Hi,
To connect to a SQL Server from a Xamarin app (using Visual Studio, so some instructions might change), I followed this process:

  1. Add in a System.Data reference to your project
  2. Add in a using directive "using System.Data.SqlClient"
  3. Define connection string and open the connection using SqlConnection(connectionString)
  4. Manipulate database as normal

My code connects to a SQL database located on a server (not localhost) and then searches for an account number to check if it exists. The code is:

string connectionString = @"Server=;Database=;User Id=;Password=;Trusted_Connection=true";
string databaseTable = "";
string referenceAccountNumber = "0001134919";
string selectQuery = String.Format("SELECT * FROM {0} WHERE [Account_Number] = '{1}' ", databaseTable, referenceAccountNumber);

    try
    {
        using (SqlConnection connection = new SqlConnection(connectionString))
        {                   
            //open connection
            connection.Open();

            SqlCommand command = new SqlCommand(selectQuery, connection);

            command.Connection = connection;
            command.CommandText = selectQuery;
            var result = command.ExecuteReader();
  //check if account exists
            var exists = result.HasRows;
        }
    }
    catch (Exception exception)
    {
        #region connection error
        AlertDialog.Builder connectionException = new AlertDialog.Builder(this);
        connectionException.SetTitle("Connection Error");
        connectionException.SetMessage(exception.ToString());
        connectionException.SetNegativeButton("Return", delegate { });
        connectionException.Create();
        connectionException.Show();
        #endregion
    }`