Saturday, July 30, 2016

windows could not start the mysql56 service on local computer

First try to stop the MySQL service if its in running mode.
In the next step please try to open mysql path (C:\ProgramData\MySQL\MySQL Server 5.7\Data)
Then delete both ib_logfile0 and ib_logfile1.
And finally restart the service

Thursday, June 23, 2016

List to Comma Seperated String in C#

 var SelectedVals = loadedObject.somelist.Select(s =>  s.string).ToList();
 loadedObject.Values = string.Join(",", SelectedVals);

Tuesday, June 21, 2016

How to convert class into xml

    In Model :

    [XmlRoot(ElementName = "Process")]
    public class ExampleModel
        public string Organization { get; set; }
        public string  Name { get; set; }
        public RangeCategory<string> Category { get; set; }

In Controller

XmlDocument xmlDoc = new XmlDocument();
            XmlSerializer xmlSerializer = new XmlSerializer(model.GetType());

            using (MemoryStream xmlStream = new MemoryStream())
                xmlSerializer.Serialize(xmlStream, model);
                xmlStream.Position = 0;

                XmlNodeList xmlnode = xmlDoc.GetElementsByTagName("ProcessControl");
                XmlNode root = xmlDoc.DocumentElement;

                string path = AppDomain.CurrentDomain.BaseDirectory + @"\Uploads\Process\";   --- save it into folder
                if (!System.IO.File.Exists(path))
                    System.IO.FileInfo file = new System.IO.FileInfo(path);
                xmlDoc.Save(path + model.ProcessName + ".xml");


Custom Search
Protected by Copyscape Plagiarism Software