Search the Community
Showing results for tags 'csharp'.
-
As the title asks, I am making a small programme which in which I need to generate a audio output using text to speech (preferably in a wav format). This is going to be used for a TTRPG game (creating audio for robots etc. so it's ok if it sounds robotic) What is a good text to speech add in which I can use. I have a couple requirements for this 1) This is a home project, with no budget, so it should be Free 2) It must have access to a number of different voices, more the better, I will need at least 10-20, I am happy to install custom voices packages here, as long as it's not too much of a pain 3) It should be reasonably easy to interface with, but I am willing to deal with some level of difficulty 4) Additionally, it would be ideal if I could run it locally on a laptop, encase I don't have access to the internet when running it, as I may be using this for an in person game. However, if this isn't possible I am happy to require the internet, but it must still be free. Any questions please ask.
-
For some backstory, I'm currently taking a high school networking class and we have a toaster that is passed down to each incoming senior class. Some friends and I want to put a Raspberry Pi in the toaster and be able to control it through the computer. What language would be best? I would assume like C# or something like that but if someone has a good recommendation that's not ungodly difficult to learn, that'd be great. This is going to be a really dumb but cool project. Raspberry Pi 4 (8GB Ram model)
-
I am working on the beginnings of my first UWP app, and am a little confused. One of the key benefits to UWP apps is supposed to be their automatic scalability, and developers are encouraged to set the sizes of UI elements in multiples of four (for easier scaling across platforms). I am using a Raspberry Pi 3 (running Win10 IoT Core), and using a screen with an 800x480 resolution. In VS2019, I get an xaml preview for my UI that shows me what it would look like on certain device presets. The closest preview preset to my screen is one that's 1024*768. Here is my code to create sections in the UI and set their colors (so I can see the "zones" I have created): <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="704"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="128"/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Rectangle Fill="Coral" Width="128"/> <Rectangle Fill="Gray" Grid.Column="1" Grid.Row="0"/> <Rectangle Fill="Red" Grid.Row="1"/> <Grid Grid.Column="2" Grid.Row="1"> </Grid> </Grid> This is what I would like the UI to look like across all platforms. Vs. What actually displays on my prototype screen: The final system will have a different display than the one I am using to test, so the row and column values must scale with the display parameters. Here is the specific part related to establishing Row/column length/height: <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="704"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="128"/> <ColumnDefinition/> </Grid.ColumnDefinitions> I have found that within Xaml and C# I could do SystemParameters.FullPrimaryScreenHeight and it would return me the height of the display/window, meaning I could use the formula SystemParameters.FullPrimaryScreenHeight-(SystemParameters.FullPrimaryScreenHeight/12)=Properly scaled vertical resolution to find my needed height for the row. Unfortunately, I cannot do arithmetic operations using Xaml alone. I know that there is some way to use Xaml in conjunction with C#, but this is my first time developing based on Microsoft's UWP. I'm sure that the combination of Xaml and C# is a fairly common practice, like HTML and CSS or HTML and JS, but I am just unsure how to do it. Sorry for the word-vomit, but I couldn't think of a simple way to explain this.
-
Hello, I have a Class CLASS1 containing multiple Strings, a String array and an Array of CLASS2 CLASS2 contains a String and an Integer, I currently store CLASS1 objects by Serializing them into XML and Deserializing them when I need to read them, but I want to be able to filter them more easily using SQL how can I store them in a way that I can read and filter them using one SELECT command, like I would when deserializing the xml document. The size of the Arrays isn't fixed I tried storing the two arrays in their own tables conecting them using foreign keys to the table were the rest of Class1 values are stored, but when I read them I get an extra output for every Element in each of the arrays, but I want just one output containing every element of both arrays and the other values from Class1
-
So I am currently writing an Asp.net website to track your inventory for an RPG, so I need to read the values for the items, now im wondering what would be the better format to store the items in. I have an class Item consistiong of multiple strings, ints and string[]s this file/table would not be written to by the user the program just needs to filter it to find the right item.
-
Hi there, Within my C# project I have a function that gets the time now in a double. However, in 4 occasions the output to the database has been 3 digits. Here is the code: public double SQRGetTimeNow() { var timezone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time"); var dateTime = TimeZoneInfo.ConvertTime(DateTime.Now, timezone); double timeInt = Convert.ToDouble(dateTime.ToString("HH:mm:ss").Replace(":", "")); return timeInt; } This function should always return the likes of 13:56:32 = 135632 or 05:45:32 = 054532 When saving the 5am time above to the database it remove the zero (expected) - First 4 are missing the zero in front of them but I have a converter for placing the zero there when displaying. But 4 times this function has returned 3 or 4 digit results and output them to the database? Anyone have an idea why?
-
Hello, I am currently developing an Asp.net application I am developing it on windows using Visual Studio 2019, how do I easily make a Docker image that I can run on Linux? Thanks in advance
-
Started from this thread: I'm using C# and WPF to create the interface, and NvAPIWrapper to interact with NVIDIA APIs: https://github.com/tylercamp/ezgpuctl I've managed a basic MVP which can display GPU info and apply OCs with core offset, memory offset, and power target. Mostly using this thread to share info about this project, though it's still not entirely functional yet (recent commit removes OC GUI as I reorganize UI). Putting this thread up early in case someone wants to try their hand at adding support for AMD GPUs. Anyone interested can comment here, and should try getting readings and applying an OC using a local C# project before bringing anything into this. (I don't have abstractions yet to easily swap out the underlying GPU interface.) A C++ implementation works too, I can just write a C# wrapper for it. Not looking for this to become an in-depth OC tool (ie, no frequency curves), and GPU monitoring is essentially just for the user to verify the current GPU state, so don't need to get in-depth with reporting/OC capabilities. This is partly to constrain design scope, partly because NvAPIWrapper doesn't seem to have all of the NVIDIA APIs needed for more advanced stuff. For reference on what data to fetch, these are the current classes I have for managing GPU data: https://github.com/tylercamp/ezgpuctl/tree/main/GPUControl.Lib/GPU Screenshots:
- 5 replies
-
- overclocking
- open-source
-
(and 3 more)
Tagged with:
-
Title
- 7 replies
-
- cs
- programming
-
(and 1 more)
Tagged with:
-
Hey guys just looking for feedback on my commenting. Its for a school project so just wondering if any more comments are needed or if you'd do anything different. namespace Dataset.App.Wpf { public class MainWindowViewModel : ViewModelBase { private Timer _currentTime; // Timer object to trigger every second private int _labelCount; // Count to cycling the label display public MainWindowViewModel() { StartCurrentTime(); // start timer //populate offset list for user selection var units = new List<OffsetUnit>(); foreach (OffsetUnit item in Enum.GetValues(typeof(OffsetUnit))) { units.Add(item); } OffsetUnits = units.ToList(); SelectedOffsetUnit = OffsetUnit.Hour; // Select default offset unit as Hour } /// <summary> /// Trigger when browse button is clicked /// </summary> private RelayCommand _BrowseCommand; public ICommand BrowseCommand { get { if (_BrowseCommand == null) _BrowseCommand = new RelayCommand(() => OnBrowse()); return _BrowseCommand; } } /// <summary> /// Pop open dialog windows and allow user to select dataset file /// </summary> private void OnBrowse() { try { var openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.Title = "Input file"; openFileDialog.Multiselect = false; var result = openFileDialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) // If user click okay on open dialog { using (var mystream = openFileDialog.OpenFile()) // try read if file is currently in use, will throw error if file is currently in use { if (mystream != null) FileDirectory = openFileDialog.FileName; // Set file directory to FileDirectory for display on UI } if (string.IsNullOrEmpty(FileDirectory)) // if FileDirectory is empty or null, return return; Datasets = FileFormatHelper.Parse(FileDirectory).ToObservableCollection(); //Parse directory file and assign to dataset if (Datasets.Count == 0) // if dataset parsed with zero count, throw error as file might be invalid format { throw new Exception("There is problem with parsing input file"); } foreach (var item in Datasets) //If dataset is valid, set offset unit to each set by user selected offset value { item.PopulateDates(SelectedOffsetUnit); } SelectedDataset = Datasets.FirstOrDefault(); //Select first set as default OnPlot();//trigger plot update } } catch (Exception e) // if any error above show message box { MessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } /// <summary> /// Will trigger when validate button is clicked /// </summary> private RelayCommand _ValidateCommand; public ICommand ValidateCommand { get { if (_ValidateCommand == null) _ValidateCommand = new RelayCommand(() => OnValidate()); return _ValidateCommand; } } private void OnValidate() { var validatingResult = FileFormatHelper.Validate(FileDirectory); //Parse directory file and perform validation if (validatingResult.Item1) // show messagebox base on validation result { MessageBox.Show("Validation success. No missing datasets", "Success", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Validation Fail. " + validatingResult.Item2, "Failed", MessageBoxButton.OK, MessageBoxImage.Error); } } /// <summary> /// trigger when generate plot is clicked /// </summary> private RelayCommand _PlotCommand; public ICommand PlotCommand { get { if (_PlotCommand == null) _PlotCommand = new RelayCommand(() => OnPlot()); return _PlotCommand; } } private void OnPlot() //Plot selected dataset { PopulatePlot(SelectedDataset); } /// <summary> /// Trigger when export button is clicked /// </summary> private RelayCommand _ExportCommand; public ICommand ExportCommand { get { if (_ExportCommand == null) _ExportCommand = new RelayCommand(() => OnExport()); return _ExportCommand; } } /// <summary> /// popup savefiledialog and prompt user with export file option /// </summary> private void OnExport() { var dlg = new System.Windows.Forms.SaveFileDialog(); dlg.Title = "Export Dataset"; dlg.DefaultExt = ".txt"; dlg.Filter = "Text (*.txt)|*.txt|All files (*.*)|*.*"; //filter files by extension dlg.FileName = "Dataset"; var result = dlg.ShowDialog(); //Show dialog if (result == System.Windows.Forms.DialogResult.OK) { if (string.IsNullOrEmpty(dlg.FileName)) return; var exportText = FileFormatHelper.Export(this.Datasets.ToList()); //get export string from file format helper File.WriteAllText(dlg.FileName, exportText); //Write file Process.Start(dlg.FileName); //Open file } } /// <summary> /// trigger when exit is clicked /// </summary> private RelayCommand _ExitCommand; public ICommand ExitCommand { get { if (_ExitCommand == null) _ExitCommand = new RelayCommand(() => OnExit()); return _ExitCommand; } } private void OnExit() { System.Windows.Application.Current.Shutdown(); } /// <summary> /// Initiate timer object and refresh every 1000 millisecond /// </summary> private void StartCurrentTime() { _currentTime = new Timer(); _currentTime.Interval = 1000; // Hook up the Elapsed event for the timer. _currentTime.Elapsed += OnCurrentTimeEvent; // Have the timer fire repeated events (true is the default) _currentTime.AutoReset = true; // Start the timer _currentTime.Enabled = true; _currentTime.Start(); } /// <summary> /// Elapsed event to trigger update of current time. If dataset is loaded also update cycling of the label /// </summary> /// <param name="source"></param> /// <param name="e"></param> private void OnCurrentTimeEvent(Object source, System.Timers.ElapsedEventArgs e) { Application.Current.Dispatcher.Invoke(() => { CurrentTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); if (Datasets != null && Datasets.Count > 0) { var currentIndex = _labelCount % Datasets.Count; var dataset = Datasets[currentIndex]; DatasetTimerInfo = string.Format("Dataset: {0}, Creation Time: {1}", dataset.Title, dataset.RecordingDateTime.ToString("dd/MM/yyyy HH:mm:ss")); _labelCount++; } }); } /// <summary> /// Populating dataset plot /// </summary> /// <param name="setName">Name of dataset to plot, if missing method is return with no action</param> public void PopulatePlot(string setName) { var ds = Datasets.FirstOrDefault(x => x.Title == setName); if (ds != null) PopulatePlot(ds); } /// <summary> /// Populating dataset plot /// </summary> /// <param name="ds">dataset to plot</param> public void PopulatePlot(DatasetObject ds) { if (ds == null) return; Model = ds.GetPlotModel(SelectedPlotOption); } /// <summary> /// List of offset unit for user selection /// </summary> private List<OffsetUnit> _OffsetUnits; public List<OffsetUnit> OffsetUnits { get { return _OffsetUnits; } set { if (value == _OffsetUnits) return; _OffsetUnits = value; RaisePropertyChanged("OffsetUnits"); } } /// <summary> /// Current selection of offset unit /// </summary> private OffsetUnit _SelectedOffsetUnit; public OffsetUnit SelectedOffsetUnit { get { return _SelectedOffsetUnit; } set { if (value == _SelectedOffsetUnit) return; _SelectedOffsetUnit = value; if (Datasets != null) foreach (var item in Datasets) { item.PopulateDates(SelectedOffsetUnit); } OnPlot(); RaisePropertyChanged("SelectedOffsetUnit"); } } /// <summary> /// Current user selected plot type /// </summary> private PlotOption _SelectedPlotOption; public PlotOption SelectedPlotOption { get { return _SelectedPlotOption; } set { if (value == _SelectedPlotOption) return; _SelectedPlotOption = value; OnPlot(); RaisePropertyChanged("SelectedPlotOption"); } } /// <summary> /// Time label display on UI /// </summary> private string _CurrentTime; public string CurrentTime { get { return _CurrentTime; } set { if (value == _CurrentTime) return; _CurrentTime = value; RaisePropertyChanged("CurrentTime"); } } /// <summary> /// Plot Model to be binded with oxyplot graph /// </summary> private PlotModel _Model; public PlotModel Model { get { return _Model; } set { if (value == _Model) return; _Model = value; RaisePropertyChanged("Model"); } } /// <summary> /// Label of cycling dataset display on UI /// </summary> private string _DatasetTimerInfo; public string DatasetTimerInfo { get { return _DatasetTimerInfo; } set { if (value == _DatasetTimerInfo) return; _DatasetTimerInfo = value; RaisePropertyChanged("DatasetTimerInfo"); } } /// <summary> /// Current selection of dataset /// </summary> private DatasetObject _SelectedDataset; public DatasetObject SelectedDataset { get { return _SelectedDataset; } set { if (value == _SelectedDataset) return; _SelectedDataset = value; RaisePropertyChanged("SelectedDataset"); } } /// <summary> /// List of current imported datasets /// </summary> private ObservableCollection<DatasetObject> _Datasets; public ObservableCollection<DatasetObject> Datasets { get { return _Datasets; } set { if (value == _Datasets) return; _Datasets = value; RaisePropertyChanged("Datasets"); } } /// <summary> /// Current selected importfile directory /// </summary> private string _FileDirectory; public string FileDirectory { get { return _FileDirectory; } set { if (value == _FileDirectory) return; _FileDirectory = value; RaisePropertyChanged("FileDirectory"); } } } public class DatasetObject : ObservableObject { /// <summary> /// if filtering is enabled /// </summary> private bool _IsFiltering; public bool IsFiltering { get { return _IsFiltering; } set { if (value == _IsFiltering) return; _IsFiltering = value; RaisePropertyChanged("IsFiltering"); } } //These properties assist with filtering if filtering is perform by value instead of date /// <summary> /// Is filter by value lowerbound /// </summary> private bool _IsLowerBound; public bool IsLowerBound { get { return _IsLowerBound; } set { if (value == _IsLowerBound) return; _IsLowerBound = value; RaisePropertyChanged("IsLowerBound"); } } /// <summary> /// Is filter by value upperbound /// </summary> private bool _IsUpperBound; public bool IsUpperBound { get { return _IsUpperBound; } set { if (value == _IsUpperBound) return; _IsUpperBound = value; RaisePropertyChanged("IsUpperBound"); } } /// <summary> /// value of lower bound /// </summary> private double _LowerBoundValue; public double LowerBoundValue { get { return _LowerBoundValue; } set { if (value == _LowerBoundValue) return; _LowerBoundValue = value; RaisePropertyChanged("LowerBoundValue"); } } /// <summary> /// value of upper bound /// </summary> private double _UpperBoundValue; public double UpperBoundValue { get { return _UpperBoundValue; } set { if (value == _UpperBoundValue) return; _UpperBoundValue = value; RaisePropertyChanged("UpperBoundValue"); } } /// <summary> /// current selection of filtering date /// </summary> private DateTime _SelectedFilteredDate; public DateTime SelectedFilteredDate { get { return _SelectedFilteredDate; } set { if (value == _SelectedFilteredDate) return; _SelectedFilteredDate = value; RaisePropertyChanged("SelectedFilteredDate"); } } /// <summary> /// list of dates for user to choose filtering date /// </summary> private List<DateTime> _Dates; public List<DateTime> Dates { get { return _Dates; } set { if (value == _Dates) return; _Dates = value; RaisePropertyChanged("Dates"); } } /// <summary> /// Name of the dataset /// </summary> private string _Title; public string Title { get { return _Title; } set { if (value == _Title) return; _Title = value; RaisePropertyChanged("Title"); } } /// <summary> /// Initial recoring time /// </summary> private DateTime _RecordingDateTime; public DateTime RecordingDateTime { get { return _RecordingDateTime; } set { if (value == _RecordingDateTime) return; _RecordingDateTime = value; RaisePropertyChanged("RecordingDateTime"); } } /// <summary> /// offset value /// </summary> private double _SampleOffset; public double SampleOffset { get { return _SampleOffset; } set { if (value == _SampleOffset) return; _SampleOffset = value; RaisePropertyChanged("SampleOffset"); } } /// <summary> /// data of the set /// </summary> private List<double> _Datas; public List<double> Datas { get { return _Datas; } set { if (value == _Datas) return; _Datas = value; RaisePropertyChanged("Datas"); } } /// <summary> /// Get PlotModel to be bind to oxyplot /// </summary> /// <param name="pltOption"></param> /// <returns></returns> public PlotModel GetPlotModel(PlotOption pltOption)//, bool resetOffset { //get boundary filter by value var bound = GetBoundFilter(); if (!double.IsNaN(bound.Item2) && bound.Item1 > bound.Item2) // check if user input boundary is valid { MessageBox.Show("Lower bound cannot be greater than upper bound", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return null; } var datasTuples = ProcessLowerUpperBoundSeries(bound); //Process filter by value, not active by default datasTuples = ProcessPlotOptionSeries(datasTuples, pltOption); // Process series base on user plot type selection var tmpModel = new PlotModel { Title = Title, LegendPlacement = LegendPlacement.Outside }; //set title for plot and placement of legend var series = new LineSeries { Title = Title, MarkerType = MarkerType.Circle }; // set title for series and marker type var dateTimeAxis = new DateTimeAxis(); // set xaxis to date dateTimeAxis.Position = AxisPosition.Bottom; dateTimeAxis.Key = "dateTimeAxis"; tmpModel.Axes.Add(dateTimeAxis); // add axis object to plot for (int i = 0; i < datasTuples.Count; i++) { if (datasTuples.Item1 >= GetFilterDate()) //perform filter by date series.Points.Add(new DataPoint(DateTimeAxis.ToDouble(datasTuples.Item1), datasTuples.Item2)); //add plot point to graph } tmpModel.Series.Add(series); //add series to graph return tmpModel; } /// <summary> /// Get filtered serie /// </summary> /// <returns></returns> public List<Tuple<DateTime, double>> GetFilteredSeries() { var serie = ProcessLowerUpperBoundSeries(GetBoundFilter()); //Process filter by value, filter is not active by default return serie.Where(x=>x.Item1 >= GetFilterDate()).ToList(); // process filter by date } /// <summary> /// Perform filtering of data series with value boundary /// </summary> /// <param name="LowerUpperBound">boundary object Tuple<double,double></param> /// <returns></returns> private List<Tuple<DateTime, double>> ProcessLowerUpperBoundSeries(Tuple<double, double> LowerUpperBound) { var lowerbound = !double.IsNaN(LowerUpperBound.Item1) ? LowerUpperBound.Item1 : double.NegativeInfinity; // if lower bound not set to negative infinit var upperbound = !double.IsNaN(LowerUpperBound.Item2) ? LowerUpperBound.Item2 : double.PositiveInfinity; // if lower bound not set to positive infinit var datasTuples = new List<Tuple<DateTime, double>>(); for (int i = 0; i < Datas.Count; i++) { if (Datas >= lowerbound && Datas <= upperbound) // If data pass the bound add to list { var offsetTime = Dates; datasTuples.Add(new Tuple<DateTime, double>(offsetTime, Datas)); } } return datasTuples; // return filtered value } /// <summary> /// Processing series point based on user selection /// </summary> /// <param name="serie">Original serie</param> /// <param name="pltOption">Selected Option</param> /// <returns></returns> private List<Tuple<DateTime,double>> ProcessPlotOptionSeries(List<Tuple<DateTime,double>> serie,PlotOption pltOption) { switch (pltOption) { case PlotOption.Normal: return serie; case PlotOption.ThreePointsMovingAverage: return ThreePointMovingAverage.Process(serie); case PlotOption.WhiteNoise: return WhiteNoiseHelper.Process(serie); case PlotOption.Cumulative: return CumulativeHelper.Process(serie); default: return new List<Tuple<DateTime, double>>(); } } /// <summary> /// Calculating offset from recording date and offset index with unit of offset /// </summary> /// <param name="dt"></param> /// <param name="i"></param> /// <param name="unit"></param> /// <returns></returns> private DateTime CalculatingOffset(DateTime dt, int i, OffsetUnit unit) { switch (unit) { case OffsetUnit.Second: return dt.AddSeconds(SampleOffset * i); case OffsetUnit.Hour: return dt.AddHours(SampleOffset * i); case OffsetUnit.Day: return dt.AddDays(SampleOffset * i); case OffsetUnit.Month: return dt.AddMonths(Convert.ToInt32(SampleOffset) * i); default: return dt; } } /// <summary> /// repopulate list filter selection base on new offset unit select /// </summary> /// <param name="unit"></param> public void PopulateDates(OffsetUnit unit) { var result = new List<DateTime>(); for (int i = 0; i < Datas.Count; i++) { result.Add(CalculatingOffset(RecordingDateTime, i, unit)); } Dates = result.ToList(); SelectedFilteredDate = Dates.FirstOrDefault(); //select first of list as default } /// <summary> /// Get bound value if filter is perform by value, inactive by default /// </summary> /// <returns></returns> private Tuple<double, double> GetBoundFilter() { var lowerValue = double.NaN; var upperValue = double.NaN; if (IsFiltering) { if (IsLowerBound) lowerValue = LowerBoundValue; if (IsUpperBound) upperValue = UpperBoundValue; } return new Tuple<double, double>(lowerValue, upperValue); } /// <summary> /// Get filter date value, if not active date filter will return date minvalue /// </summary> /// <returns></returns> private DateTime GetFilterDate() { return IsFiltering ? SelectedFilteredDate : DateTime.MinValue; } } /// <summary> /// Enum for plot type selection /// </summary> public enum PlotOption { Normal, ThreePointsMovingAverage, WhiteNoise, Cumulative, } /// <summary> /// Offset unit for selection /// </summary> public enum OffsetUnit { Second, Hour, Day, Month, } }
-
So i made a simple VS19 console app (.net framework), added nothing to static void Main(string[] args) {} But somehow the it still manages to print a newline. i simply want it to just not print a newline. Video showing the problem in way more detail.
-
Hi there Having a little trouble trying to work out how to read then separate data from a text file. I have we will say 3 datasets like Dataset 1 and 3 pieces of data {Data 1} all separate and i was wondering how do i read these in then bring them together And check that there is the same number of Datasets as data to use?. I have attempted to just separate datasets but cant make it work. Any ideas? its all in c# btw.
-
Hi guys, I'd like to create a windows application to keep all my data of my clients in a simple application. I have chosen to use visual studio 2015. I created a fillable form using the windows application template with textboxes in it etc. and now I would like all the data I put in the textboxes, to save in the table in database. I created the database within visual studio, just to try making it myself, but can't get that one to work. Is there anyone that would like to help or guide me? Thank you guys in advance. " Sorry for my English "
- 2 replies
-
- visualstudio
- csharp
-
(and 2 more)
Tagged with:
-
I know this is a totally newby question, but how do you actually debug. Is there like a line of code that you need to type out to debug or is it just base off the debug console where it shows the error messages and what not. Sometimes i even experienced errors when there is no errors to be found, i don't actually get it at all.
-
What I got so far: Logic.Data.Entities.PhoneLineBills.RemoveRange(GetDefaultQuery().Where(plr => purgingAccounts.Any(prgn => plr.Month < earliestMonth && plr.AccountId == prgn.AccountId)).ToList()); I need to remove certain data from a table in the DB where the row's account id (which is a foreign key) is equal to one of those in the list "purging account" AND be between the given months. (the month part works fine). this is the error I'm getting: An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code Additional information: Unable to create a constant value of type 'PLR.Core.Model.Account'. Only primitive types or enumeration types are supported in this context. thanks for your help!
-
Hi there, I am creating a flight simulation that focuses on the realistic delay due to varied factors. I'm not an experienced programmer or with unity. I have a simple UI element within my game that displays the plane's (UAV) altitude, speed, distance from a base point and the latency. My issue is that the script used for this was in JavaScript and im no expert, so I need help with converting this to c# to get the figures as they update within the game, displayed on screen! Here is my code: var plane : Transform; var b : Transform; public var item2 : GUIContent = GUIContent("Altitude"); public var item3 : GUIContent = GUIContent("Speed"); private var guiSkin : GUISkin; var Alt:int; var Spd:int; var Bloc:int; var latency: float; var Distance:int; var obritalSatellite:int; //var PosZ:int; function OnGUI(){ GUI.skin = guiSkin; GUI.Box(Rect(0, Screen.height-120, 200, 120),"Plane"); GUI.Label(Rect(20, Screen.height-80, 100, 50), "Altitude"); GUI.Label(Rect(15, Screen.height-60, 100, 50), "Speed"); GUI.Label(Rect(80, Screen.height-80, 100, 50), Alt.ToString()); GUI.Label(Rect(80, Screen.height-60, 100, 50), Spd + " m/s".ToString()); GUI.Label(Rect(10, Screen.height-40, 100, 50), "Base"); GUI.Label(Rect(80, Screen.height-40, 100, 50), Distance + " m".ToString()); GUI.Label(Rect(10, Screen.height-20, 100, 50), "latency"); GUI.Label(Rect(80, Screen.height-20, 100, 50), latency + " ms".ToString()); } function Update(){ Alt=plane.transform.position.y; Spd=plane.GetComponent.<Rigidbody>().velocity.magnitude; Bloc=b.transform.position.z; //distance measurement from base to plane var distance = Vector3.Distance(plane.transform.position, b.transform.position); obritalSatellite = 70000; Distance = distance; //delay calculation latency1 = (obritalSatellite + Distance) *0.000003 + 0.120; latency = latency1; } My main issue is converting the function Update to c#. Any help would be ideal, Thank You. Regards, Andre
-
Hi, I'm planning on creating a puzzle/platformer game that has different controllable characters (press 1 for one char, press 2 for another, etc), but only uses the same movement control (WASD + Space for jumping). How can I approach this? Please take note I'll only be using Visual Studio XNA with Monogame (no other engines) Here's my current options: - creating the multiple characters as different objects and calling them upon press of the button - creating movement control as an object and use it for all of the characters on the Update stage Additional question: How do I make the camera movement smooth between transitions of the 2 characters?
- 1 reply
-
- game development
- csharp
-
(and 1 more)
Tagged with:
-
Hi, So a little bit of background info: I'd like to create a program that could run 0-24 and would do the following: receive a Facebook message with a YouTube URL, download the video and finally send it back as a reply. It is because my data plan includes unlimited data for Facebook, which I never use, and this way I could get unlimited YouTube. I've only started programming recently, and I can use C++ and C#, although I'm not very fast or experienced in either of them. After a bit of searching, I found that the Messenger API uses Javascript, but I haven't used Java or Javascript ever. So: Is there already a bot/program that could do this (kinda like IFTTT)? If there isn't where how I start writing this program, should I use C# or should I learn Javascript? Thanks in advance!
-
Anyways, without the use of engines I'm trying to create a snow effect in XNA. I'm definitely sure I'm doing something wrong since I'm targeting for a 100-count array and it only produces 10 (including updates). Here's my file and looking for some help in displaying all 100 in timed manner: public class Game1 : Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D snowTex; Rectangle[] snowRect; int[] randX; int posY, ctr, arrayCtr; Random rnd; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.PreferredBackBufferHeight = 768; graphics.PreferredBackBufferWidth = 1366; IsMouseVisible = true; } protected override void Initialize() { snowRect = new Rectangle[100]; randX = new int[100]; ctr = 0; arrayCtr = 0; rnd = new Random(); posY = -5; for (int q = 0; q < snowRect.Length; q++) { randX[q] = rnd.Next(0, 1366); } base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); snowTex = Content.Load<Texture2D>(@"Snow"); } protected override void UnloadContent() { } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); posY++; ctr++; for (arrayCtr = 0; arrayCtr < 100;) { if (ctr == 120) // TRIGGERS A NEW SET OF SNOW PARTICLES EVERY 2 SECONDS { ctr = 0; for (int q = 0; q < 10; q++) { randX[q] = rnd.Next(0, 1366); // RANDOMIZES NEW RANDOM X POSITIONS } } arrayCtr += 10; } for (int q = 0; q < 100; q++) { snowRect[q] = new Rectangle(randX[q], posY, 10, 10); if (snowRect[q].Y > 770) //IF SNOW[Q] GOES PAST GRAPHICS WIDTH { posY = -5; } } base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); for (int x = 0; x < 100;) { for (int y = 0; y < 10; y++) { spriteBatch.Draw(snowTex, snowRect[y], Color.White); } x += 10; } spriteBatch.End(); base.Draw(gameTime); } }
-
Hi all! I'm sorting through my music collection, removing duplicates, correcting wrong labels and tags, etc. I did a lot of research on apps and so on that I can use and found Metatogger to be the most suitable for me. One of its functions is to write a C# script to control the tags how I want to - it provides a few example scripts which have been very useful but I need something that isn't in the examples. What it needs to do: Take "feat. artist" from the ARTIST tag and move it to the end of the TITLE tag within brackets. For example: ARTIST: Bon Jovi Feat. Bob Geldof TITLE: I Don't Like Mondays Should become: ARTIST: Bon Jovi TITLE: I Don't Like Mondays (Feat. Bob Geldof) Things that may be useful: Metatogger Roslyn Documentation (Metatogger uses Rosyln compiler) Metatogger's Example Scripts If anyone would be able to write a script that would be able to do that, I would be very grateful. Thanks!
- 2 replies
-
- metatogger
- music
-
(and 2 more)
Tagged with:
-
BeeperPlayer An 8-bit Music Synthesiser So recently, I've been working on an 8-bit style music synthesiser, written using NAudio in C# .NET, and it works surprisingly well, all things considered. Why should I care? That's a good question, you see, I don't really understand music. Stuff like tempo makes little to no sense to me, thus all music is composed in milliseconds. Which for music enthusiasts, who understand this stuff, isn't great. It also makes syncing sounds across multiple tracks very difficult. Thus, I need your help. The app is open source, under the MS-PL, and is available here on GitHub. I need help to make this more approachable to people used to music and such. DOWNLOAD: https://github.com/WamWooWam/BeeperPlayer/releases/tag/1.1.0a Yes the samples are a bit shit. No, none of them are finished. But they work, so I don't care. DEPENDENCIES: .NET Framework 4.5.2 or Later Windows Vista SP2 or Later A DirectSound compatible sound card (by default) THINGS THAT WORK: Pulse, Sine, Triangle, and Sawtooth wave generation White and Pink noise generation (Kinda) PCM Samples ZIP-based file compression Unlimited concurrent tracks Volume, pan and loop support Attack, Decay, Sustain and Release envelopes Export to WAV and MP3 THINGS THAT DON'T WORK: No GUI (player or composer) Noise intensity not configurable As usual, nothing malicious here, You can look through the code, compile it yourself if you're paranoid. Have a look, tell me what's good, bad, ugly etc.
-
I'm not sure how to approach the plan, but I want to make a 10-degree tilt on a Rectangle object in XNA. I have two options: Option 1: Draw a tilted rectangle on-hand. However, the bounding box of the rectangle will be set at 0-degree tilt. Option 2: Draw a 0-degree tilt rectangle. I have no idea how to tilt the object
-
Hey guys, lately i've discovered automapper exists, and while i was playing with it i got a question: can it also work for mapping parameters to the properties of an instance of a class(considering both the parameters and the properties have the same name and type) hope i'm being clear, basically i have this code right now: public Cliente CrearCliente(string Nombre, string Apellido, string Calle, int NumeroDomicilio, string Depto, string Piso, int DNI, string Email, string Fax, int Cuit, decimal TopeCtaCte, int TipoRentaMunicipalId, int TipoRentaProvincialId, int TipoSituacionImpositivaId, int Id, List<TelefonosClientes> TelefonosClientes) { return new Cliente() { Apellido = Apellido, Calle = Calle, Depto = Depto, DNI = DNI, Email = Email, Id = Id, Nombre = Nombre, NumeroDomicilio = NumeroDomicilio, Piso = Piso, TipoRentaMunicipalId = TipoRentaMunicipalId, TipoRentaProvincialId = TipoRentaProvincialId, TipoSituacionImpositivaId = TipoSituacionImpositivaId, TelefonosClientes = TelefonosClientes, Fax = Fax, Cuit = Cuit, TopeCtaCte = TopeCtaCte }; } and what i'm guessing is that there should be some way to make it something like: public Cliente CrearCliente(string Nombre, string Apellido, string Calle, int NumeroDomicilio, string Depto, string Piso, int DNI, string Email, string Fax, int Cuit, decimal TopeCtaCte, int TipoRentaMunicipalId, int TipoRentaProvincialId, int TipoSituacionImpositivaId, int Id, List<TelefonosClientes> TelefonosClientes) { return something.something.createinstancefromparameters(Cliente) } sorry for the possible crappy english, if the question is not clear(not really sure what's the best way to ask what i'm asking lol), maybe i wrote it more clearly in my stack overflow question: http://stackoverflow.com/questions/43702275/is-there-any-way-to-automatically-map-properties-from-parameters-when-creating-a tbh it's the first time i've had to ask a question there, normally things are easier to research
-
Can I put combo box values in the same column in sql server 2008 with text box values?
- 1 reply
-
- csharp
- visualstudio
-
(and 1 more)
Tagged with: