Topics
-
Pass this code from C# to F#. Menus and SubMenus.
by Guest Metaconta- 1 reply
- 789 views
I have a Menu and Sub-Menu code of the "C # 2019 console". I want to do the same but in F #. I don't understand the F # language. That's why I need help. When the program is done in F #, I will study it to familiarize myself with it. View zoom. Code C#: using System; namespace Menu_consola_18_cs { class Program { // Variable general para guardar el > de la última opción que haz entrado // en la hora de volver atrás. Por ejemplo: private static int guardarOpcion = 0; static void Main(string[] args) { Console.Title = "Menú de opciones"; // Tamaño ventana consola. …
Last reply by Calobima, -
Is F#/WPF still being actively used?
by Guest PeterWilson262- 0 replies
- 420 views
I have just finished a WPF/C# based time recording system. We were plagued by null pointer exceptions and other problems which could have been designed out using F# data modeling. I would really like to do our next project using F#, but I have misgivings that the F#/WPF combination is dead. 1. The FsXaml type provider project seems to be the most mature, but the last commit was 3 years ago. Other support libraries have never left the "Here's a nice idea stage" e.g. FSharp.Desktop.UI 2. Many F#/WPF blogs have started a series of posts with promises of more to follow - which never materialized. e.g. F# and WPF part two - functional models, decoupled views.. Why the su…
-
I calculate volume and liters of a cylinder
by Guest Metaconta- 0 replies
- 385 views
Hi: I want to do exactly this same code in F #. Just transform from C# to F# from the code below. using System; namespace Calculo_agua_sencillo_consola_INGLES_01_cs { class Program { static void Main(string[] args) { // Show window title. Console.Title = "Calculation liters of water"; // Window size. 55 X and 16Y. Console.SetWindowSize(55, 16); #region Variables. // Variables. const double Pi = 3.14; double radio = 0; double altura = 0; double volumen = 0; double litros = 0; …
-
Read dll done in C++ with console F#
by Guest Metaconta- 0 replies
- 421 views
I want to make this code in C # console, adapt it to F #. What it does is read a dll made in C ++. using System; using System.Runtime.InteropServices; namespace Consola_cs { class Program { static void Main(string[] args) { Console.WriteLine(Marshal.PtrToStringAuto(SUPER_DLL.Mensaje())); Console.WriteLine(SUPER_DLL.Suma(1764, -764).ToString()); // Pulse cualquier tecla para salir. Console.ReadKey(); } internal class SUPER_DLL { [DllImport("Super_dll.dll")] extern static public int Suma(int a, int b); [DllImport("Super…
-
I want to adapt or transform from C# code to F#.
by Guest Metaconta- 0 replies
- 385 views
Hello: I want to adapt or transform from C# code to F#. Code C#: using System; namespace radioButton_consola_02_cs { class Program { #region Variables. private static readonly string[] TEXTO = new string[] { "( ) Option A ", "( ) Option B ", "( ) Option C ", " EXIT" }; private static int itemSeñalado; private static int itemSeleccionado; #endregion static void Main(string[] args) { // Window title. Console.Title = "RadioButton"; // Window size. …
-
How to write to a text file using Fable?
by Guest cschristine- 0 replies
- 403 views
I'm trying to use Fable to convert some f# code I wrote into a web project, but I'm having some trouble with writing file output. Previously, when I just had a net core project, I could just do something like this: [iCODE]File.WriteAllText("output.txt", "hello")[/iCODE] But now if I try that, I get this error: [iCODE]error FABLE: Cannot resolve System.IO.File.WriteAllText @ ./src/App.fsproj[/iCODE] Is there something I need to import/add to make this work? Or is there a different way to write files in Fable? I would really appreciate any help or suggestions. Thank you in advance! Continue reading...
-
Printed report doesn't show values
by Guest Natella A- 0 replies
- 348 views
Hi, i am experiencing "weird" problem. Previewed report looks different from printed report. Report preview shows perfectly correct information includes all fields and variables. On Printed report some of the fields/variables come out blank. Same report sent to pdf file from preview mode comes out correct. It is just printed version that looks half empty... so confused, please help! thank you! PS using FVP8 Continue reading...
-
nameof operator doesn't work
by Guest JohnyL- 0 replies
- 340 views
I'm learning F#. Here's the code: let f x = let m = nameof x m [<EntryPoint>] let main argv = let x = f "z" 0 However, I get the following error: The value or constructor 'nameof' is not defined. What I'm doing wrong? There is no knowledge that is not power. Continue reading...
-
Visual Studio F# function 'quickinfo' signature display
by Guest Barfarkle- 0 replies
- 404 views
Just checking if this problem has already been reported for Visual Studio 2019 (I am using Community Edition 16.2.5 on Windows 10). I tried searching and didn't see anything useful but I don't really know what to search for as I have no idea what this feature could be called. The 'quickinfo' function signature display in the source code (commented text in a smaller red only font to the right in the image below) is misaligned and overwritten in spots. It doesn't disappear if you scroll it out of view. Closing the file and re-opening clears it up, at least temporarily. This is the bug part. Although I find this display can be quite useful, sometimes I just want to…
-
F# sample project can't build
by Guest Antoine Besnard- 0 replies
- 378 views
Hi, I'm having a strange behaviour with all my F# files They're all creating C# errors So I've just recreated a new F# project and here's what it look like namespace Test module Say = let hello name = printfn "Hello %s" name And errors are : { expected ; expected A namespace cannot directly contain members such as fields or methods Regarding to those errors it seems that Visual is trying to build F# with C# compiler. But the F# tools are installed : F# desktop language support F# language support F# language spport for web projects I don't really know what's wrong, bescause I already make it work on this computer …
-
Render FrameworkElement (F#) without outside WPF application
by Guest This_display_name_is_already_in_use_They_all_are- 0 replies
- 395 views
Original Text from WPF Forum: (Still relevant) We have a Class, written in F# which is basically a FrameworkElement. Internal there is a VisualCollection which holds the rendered parts - for compositioning i guess. The class itself represent a Graphic-To-Be-Rendered, which in this special case, has to be done without a UI thread and outside of a WPF application. What we do is the following: Spawn an STA Thread - Instantiate the Graphics - Populate with Data - Render to Bitmap - Return Synchronized stream Outside the STA Thread - Write stream to File The file is empty but has the correct width & length. I believe that it is not possible to…
-
F# Interactive Unresponsive
by Guest sbabaei- 0 replies
- 379 views
On Visual Studio 2017 15.9.9, I have encountered a weird issue recently. When I code directly in the Interactive windows, F# Interactive just freezes: It is OK when I send a piece of code to it from a script (ALT+ENTER) but not when I do it directly. It was pretty much the same with Python Interactive when I set it to use IPython. Since I have done a clean reinstall of my system, Python Interactive is fixed but not F# Interactive. So far as I can decipher, the Python issue relates to installed packages. I cannot figure out the reason for F#. Continue reading...
-
Await event to complete before continuing code
by Guest WojszaM- 0 replies
- 361 views
Hi, I have a question. I have a method that sends and receives messengers via serial port as a byte arrays, to SerialPort DataRecived I am adding an event that will read response and assign it to type so basically it should be easy and looks like this: async { let buffer = Array.zeroCreate<byte> port.ReadBufferSize let response = new Response(buffer) let data_recived = async{ let! read_buffer = port.AsyncReadLineAsByte() response.Data <- read_buffer printfn "Response Buffer: %A response type: %A" read_buffer response.Data …
-
Trouble connecting F# to an Entity Framework model
by Guest Mr Yossu- 0 replies
- 380 views
Hello, I've been trying out this MSDN walkthrough to connect F# to an edmx file. I started an empty solution, and added a C# class library, to which I added an Entity Framework model. I then added an F# console app to the solution. My solution now looked like this... Following what was in that MSDN article, I added the following line to my F# code file... type edmx = EdmxFile<"DonationsManagerModel.edmx", ResolutionFolder = @"..\EfModel"> However, the type name is underlined in red, and I get the error message... The provided types generated by this use of a type provider may not be used from other F# assemblies and should be marked internal or p…
-
Can the F# HtmlProvider access password protected pages?
by Guest Mr Yossu- 0 replies
- 339 views
I know how to grab data from a web page in F#... [color=#101094][font=inherit]let[/font][/color][color=#303336][font=inherit] url = @[/font][/color][color=#7d2727][font=inherit]"https://en.wikipedia.org/wiki/Doctor_Who"[/font][/color][color=#303336][font=inherit] [/font][/color][color=#101094][font=inherit]type[/font][/color][color=#303336][font=inherit] DoctorWhoData = HtmlProvider<url> [/font][/color][color=#101094][font=inherit]let[/font][/color][color=#303336][font=inherit] data = DoctorWhoData.GetSample()[/font][/color] ...which is really neat, but I want to be able to do this for a password protected page. I can't seem to find any documentation on how to…
-
F# Dapper how to create connection string.
by Guest zydjohn- 0 replies
- 374 views
Hello: I recently want to learn Dapper for F#, in order to access SQL Server database. I found some article for this topic. And I created a simple database [myDB] using SQL Server 2017, and created a small table: USE [MyDB] GO CREATE TABLE [dbo].[users] ( [iD] [int] NOT NULL, [FirstName] [nvarchar](30) NOT NULL, [LastName] [nvarchar](30) NOT NULL, CONSTRAINT [PK_Users] PRIMARY KEY(ID)) GO Add some records: INSERT INTO USERS VALUES(1, 'Jo', 'Jo') INSERT INTO USERS VALUES(2, 'John', 'Doe') Now I want to use someone's code to retrieve records from [users]: module DapperFSharp = open System.Data.SqlClient open System.Dy…
-
F# how to serialize records to nested JSon data
by Guest zydjohn- 0 replies
- 368 views
If I have some records in F#: type Coureur= { runner_name: string distance : string unit : string score: float } let stoppage = seq [ { runner_name= "No 1" ; distance = "100M"; unit = "seconds"; score = 10.0} { runner_name= "No 2" ; distance = "200M"; unit = "seconds"; score = 20.0} ] I want to serialize the records to the nested Json data, like the following: { "sports": { "measure-type": "Metric", "runner-type": "track-field", "runners": [ { "runner-name":"No 1" , "distance": "100M", "unit": "seconds", "score": 10.0 },{ "runner-name":"No 2" , "dis…
-
WPF Composites (WPF-CPS) for F#
by Guest Bryan Prendergast- 0 replies
- 382 views
FYI . . . I just added a basic 'Hello World' example of using my Fluent WPF API named WPF Composites (WPF-CPS) with F#. Just search for WPF Composites on CodePlex and search for the F Sharp Example link on its main home page. WPF Composites (WPF-CPS) is a project designed to provide an alternative, concise, C# (or IronPython or F#) code-behind approach to managing UI Framework Element composites. Composites are normally managed via XAML and DataTemplates but this library uses ID's and X-Y Coordinates instead to position elements on the screen. It works via 100% code-behind, zero XAML, has CSS-like Selectors, has Generators to generate multiple Framework Elements …
-
Any good "F# under the hood" articles/blogs?
by Guest Ingram Barclay- 0 replies
- 369 views
Can anyone point me to some good blogs/articles on what exactly is happening under the hood when F# data structures are copied and updated? I think I know what's supposed to be happening but the specifics could alter how I define my records to get the behavior I want, which is for the result of a record copy-and-update to present a new structure that points to the unchanged members of the original record as well as a new allocation for each changed member, but NOT a full brand new copy of each record as they are modified. Thanks! Ingram Continue reading...
-
F# usage
by Guest F_M_L- 0 replies
- 418 views
Hi, I'm pretty new in F# but I'm familiar to C# so i was wondering for what purposes, i can use F#, well i know its usage is mainly in data analysis and all, but mainly i was thinking to do some regular jobs using F# instead of C# so im asking if there is some areas that F# can overperformance C#, so i mean generally what are the usage of F# but not just in data analysis and big data tnx Continue reading...
-
Who's Online 0 Members, 0 Anonymous, 14 Guests (See full list)
- There are no registered users currently online