What is the difference between jedi and python language server in VS code IDE?

Jedi is an auto-completion library written in Python while the language server is implemented in C#. The latter was done for performance and to share a common code base between the Python extension for VS Code and the Python workload of Visual Studio. Eventually the language server will become the default experience in the Python …

Read more

SwiftUI TextField touchable Area

This solution only requires a @FocusState and an onTapGesture and a .background with color, and allows the user to tap anywhere, including the padded area, to focus the field. Tested with iOS 15. struct MyView: View { @Binding var text: String @FocusState private var isFocused: Bool var body: some View { TextField(“”, text: $text) .padding() …

Read more

What is the “best” way to store international addresses in a database?

Plain freeform text. Validating all the world’s post/zip codes is too hard; a fixed list of countries is too politically sensitive; mandatory state/region/other administrative subdivision is just plain inappropriate (all too often I’m asked which county I live in–when I don’t, because Greater London is not a county at all). More to the point, it’s …

Read more

XML Schema: Element that can contain elements or text?

I did some research on this a while ago and the only solution I found was to used the mixed attribute: <xs:element name=”field”> <xs:complexType mixed=”true”> <xs:sequence> <xs:element ref=”subfield” minOccurs=”0″ maxOccurs=”unbounded” /> </xs:sequence> <xs:attribute name=”name” type=”xs:string” /> </xs:complexType> </xs:element> This sadly also allows <field name=”test_field_0″> Some text I’m sure you don’t want. <subfield>Some text.</subfield> More text …

Read more

Activator.CreateInstance Vs new

This overload of the “Activator.CreateInstance” method is used by compilers to implement the instantiation of types specified by type parameters using generics. Say you have the following method: public static T Factory<T>() where T: new() { return new T(); } The compiler will convert the “return new T();” to call “CreateInstance”. In general, there is …

Read more

Text compression in PostgreSQL

Compression is enabled by default for all string types, you don’t have to tell the database to do it. Check the manual about TOAST PLAIN prevents either compression or out-of-line storage; furthermore it disables use of single-byte headers for varlena types. This is the only possible strategy for columns of non-TOAST-able data types. EXTENDED allows …

Read more