Quantcast
Channel: User Rei Miyasaka - Stack Overflow
Browsing latest articles
Browse All 45 View Live
↧

Comment by Rei Miyasaka on Visual Studio - Invalid URI: The hostname could...

Problem is that you need wildcard sometimes.

View Article


Comment by Rei Miyasaka on Multiple Tables With Same Structure Entity Framework

I've settled on doing this but with an interface instead of an abstract class.

View Article

Comment by Rei Miyasaka on Replace Multiple String Elements in C#

Note that this and many answers may be inappropriate for arbitrary replacement strings. "abc".Replace("a", "c").Replace("c", "d") will produce "dbd" as opposed to the expected "cbd".

View Article

Comment by Rei Miyasaka on Property '...' has no initializer and is not...

@MartinÄŒuka Just because everyone was doing it doesn't mean it wasn't wrong or that it wasn't horrifying. TypeScript itself was brought about because JavaScript is kind of horrifying. And the larger...

View Article

Comment by Rei Miyasaka on Rails 4 - Save address as one column in database

archive.org link for the hstore vs json page, since it's down.

View Article


Comment by Rei Miyasaka on Why is it a bad idea to have a table without a...

I'm convinced that I've come across a legitimate and common use case for a no-PK table: If a table "owns" an unordered list of items which are deleted/replaced when the owner row is updated, not having...

View Article

Comment by Rei Miyasaka on What are the best practices to add metadata to a...

What is the benefit of not putting both in json?

View Article

Comment by Rei Miyasaka on Sorting jsonb in postgresql

Will this make use of any indexes if you do an order by?

View Article


Comment by Rei Miyasaka on Escape spaces in PowerShell and cmd

Straight up, PowerShell is horrible.

View Article


Comment by Rei Miyasaka on Tail Call Optimization implementation in...

At least Microsoft's reason was technical, as dumb as it is. Firefox's makes no sense at all.

View Article

Comment by Rei Miyasaka on Using the serial port in a Ubuntu for W10 (WSL)

Yeah, this isn't working for me either.

View Article

Comment by Rei Miyasaka on VS 2022 does not refresh Error List Warnings

17.5.1. Still happening.

View Article

Comment by Rei Miyasaka on How to do argument validation of F# records

Ten years later, my use case today: normalizing a line segment so that the point to the left is first. I could do it in the constructor and guarantee that it's correct, or I could check every time. But...

View Article


Comment by Rei Miyasaka on Get ffmpeg information in friendly way

@patrick I would more blame SE's habit of killing new discussion than the people who are trying to make discussion.

View Article

Comment by Rei Miyasaka on query of type "INSERT ON CONFLICT DO NOTHING...

I wonder what implication this has for performance

View Article


Answer by Rei Miyasaka for Linq Orderby random ThreadSafe for use in ASP.NET

Probably best to write your own extension method to do it.public static class Extensions{ static readonly Random random = new Random(); public static IEnumerable<T> Shuffle<T>(this...

View Article

XHTML empty tags not treated as empty tags by any browser

So I've tried this XHTML 1.1 code (validated at validator.w3.org) in Chrome 6, IE 8, and Firefox 3.5. The <p> following the <a/> gets hyperlinked, and the <p> following the...

View Article


Trying to gain confidence in the benefits of TDD

I just bought The Art of Unit Testing from Amazon. I'm pretty serious about understanding TDD, so rest assured that this is a genuine question.But I feel like I'm constantly on the verge of finding...

View Article

ASP.NET MVC event that happens just before action is called?

I want to set the value of Thread.CurrentCulture based on some route data, but I can't find an event to hook to that fires after the routes are calculated and before the action method is called.Any ideas?

View Article

Answer by Rei Miyasaka for Are options and WithSize etc in XPlot specific to...

Very barebones charting solution using Plotly (and it works):open Newtonsoft.Jsonlet html = """<head><script...

View Article

Image may be NSFW.
Clik here to view.

Are options and WithSize etc in XPlot specific to only certain charts?

I've tried Chart.WithSize and displayZoomButtons = true in the FSLab tutorial, but nothing seems to change the output.Same thing in other projects using XPlot.GoogleCharts directly.Am I missing something?

View Article


Format built-in types for pretty printing in Deedle

I understand that in order to pretty print things like discriminated unions in Deedle, you have to override ToString(). But what about built in types, like float?Specifically, I want floats in one...

View Article


F# type error with one level of indentation, not with another

I'm going through the Hopac documentation, and I came across this bizarre type error:let create x = Job.delay <| fun () -> let c = {reqCh = Ch (); replyCh = Ch ()} Job.iterateServer x <| fun x...

View Article

Is it at all possible to use UWP APIs that require Capabilities from .NET...

I'm trying to use Bluetooth LE from F# Interactive, to which end I hope to make a C# .NET Framework class library as a proxy (because F# isn't being supported again).Some of the API works, but as soon...

View Article

Constraining queries based on aggregations of properties of associations

Quick question: would this trigger one query per each Tag item?public static IQueryable<Tag> WhereTagHasLivePosts(this IQueryable<Tag> q){ return q.Where(t => t.Posts.Where(p =>...

View Article


Answer by Rei Miyasaka for Generate a specific color for each string?

There's a crude color difference formula suggested in a Working Draft on the W3C site:Color difference is determined by the following formula: (maximum (Red value 1, Red value 2) - minimum (Red value...

View Article

How can I combine multiple refactored Select expressions in Linq (to EF or SQL)?

Say I have this view model:public class SeriesLinkViewModel{ public static Expression<Func<Series, SeriesLinkViewModel>> FromSeries = s => new SeriesLinkViewModel { Name = s.Name, Slug =...

View Article

How to target LLVM from a compiler written in F#?

I'm part way through writing a toy language in F#. I want to target LLVM, but it looks like I'll have to do some work to make that happen.It looks like I might be able to do some interop with the...

View Article

WPF TextBox/RichTextBox started from F# Interactive not accepting input

Getting this weird issue, not sure if it's just me, and I don't remember this happening before...#r "PresentationFramework"#r "PresentationCore"#r "WindowsBase"System.Windows.Window( Content =...

View Article



Make MSDeploy (Visual Studio) not delete App_Data folder but delete...

I'm using Visual Studio's Publish button to deploy my website, and want a different App_Data folder on the server. There's a checkbox for Leave extra files on destination (do not delete) which prevents...

View Article

How do I run F# Interactive on a more recent version of the framework?

.NET 4.6.2 and later enable the use of the \\?\ syntax to access long file paths on Windows 10, but F# Interactive seems only to boot using .NET 4.5.I've tried --noframework and then #ring...

View Article

Answer by Rei Miyasaka for Is there a way to identify CLR event instances in F#?

Not exactly an answer to the question, but I can't think of many other scenarios in which you'd need to identify an event instance, so maybe this is good enough:type OneHandler<'e> = { mutable h...

View Article

Is there a way to identify CLR event instances in F#?

When I'm working in F# Interactive, I often want to make changes to an event handler. Simply calling the Subscribe or Add or AddHandler functions on an event causes the old event to continue being...

View Article


Is there a reason workflow builders in F# don't use interfaces?

This is a question just out of curiosity: when you implement a workflow factory, you don't do it as an interface implementation, but rather just make sure the function signatures of the monad functions...

View Article

Answer by Rei Miyasaka for Fable.React - editing an Input field moves cursor...

Use Fable.React.Helpers.valueOrDefault instead of DefaultValue or Value:/// `Ref` callback that sets the value of an input textbox after DOM element is created.// Can be used instead of `DefaultValue`...

View Article

Is it standard practice to use type aliases to indicate parameter semantics?

Items in tuples don't have names, which means that you often don't have a clear way to document the meanings of each item.For instance, in this discriminated union:type NetworkEvent =| Message of...

View Article


How Many Items Should I have in an RSS feed? [closed]

All the information I could find regarding generating RSS feeds gives examples where an indeterminate number of items is returned.That doesn't seem too practical, especially if I have a ton of entries...

View Article


Is there such thing as a left-associative prefix operator or...

This page says "Prefix operators are usually right-associative, and postfix operators left-associative" (emphasis mine).Are there real examples of left-associative prefix operators, or...

View Article

Forcing a field of an F# type to be null

I understand well the benefit of option, but in this case, I want to avoid using option for performance reasons. option wraps a type in a class, which just means more work for the garbage collector --...

View Article

How do I use _com_ptr_t?

Say I have a class that owns a D3DDevice:class Thing{public: Thing() { D3D11CreateDevice(..., &device, ...); } ~Thing() { device->Release(); }private: ID3D11Device* device;};From what I...

View Article

Using smart pointers in a struct or class

I've written a function that loads the bytes off a file and returns a FileData struct that contains the byte buffer and the length of the buffer.I want the buffer to be deleted as soon as it's consumed...

View Article


Linked list partition function and reversed results

I wrote this F# function to partition a list up to a certain point and no further -- much like a cross between takeWhile and partition.let partitionWhile c l = let rec aux accl accr = match accr with |...

View Article

Answer by Rei Miyasaka for Is it possible to host the .Net DLR in an...

Have a look at Terrarium -- it's a game where you build your own autonomous critters in a .NET language, and they're teleported to other networked computers along with the assemblies that they're...

View Article


Answer by Rei Miyasaka for C# WPF OnPaint method alternative?

UIElement.OnRender.To be used sparingly; it's not as efficient.It's a bit of a paradigm shift.

View Article

Nice examples of using .NET 4 dynamic keyword with Linq?

So I Just got a recommendation from Amazon for LINQ to Objects Using C# 4.0: Using and Extending LINQ to Objects and Parallel LINQ (PLINQ).It says that the book introduces using the dynamic keyword...

View Article

Browsing latest articles
Browse All 45 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>